mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat: CellForceWidth component.
This commit is contained in:
23
src/components/Button/ButtonLink.js
Normal file
23
src/components/Button/ButtonLink.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import styled from 'styled-components';
|
||||
import { Button } from '@blueprintjs/core';
|
||||
|
||||
export const ButtonLink = styled(Button)`
|
||||
line-height: inherit;
|
||||
|
||||
&.bp3-small {
|
||||
min-height: auto;
|
||||
min-width: auto;
|
||||
padding: 0;
|
||||
}
|
||||
&:not([class*='bp3-intent-']) {
|
||||
&,
|
||||
&:hover {
|
||||
color: #0052cc;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
`;
|
||||
3
src/components/Button/index.js
Normal file
3
src/components/Button/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
export * from './ButtonLink';
|
||||
29
src/components/Datatable/CellForceWidth.js
Normal file
29
src/components/Datatable/CellForceWidth.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { get } from 'lodash';
|
||||
|
||||
import { getForceWidth } from 'utils';
|
||||
|
||||
export function CellForceWidth({
|
||||
value,
|
||||
column: { forceWidthAccess },
|
||||
row: { original },
|
||||
}) {
|
||||
const forceWidthValue = forceWidthAccess
|
||||
? get(original, forceWidthAccess)
|
||||
: value;
|
||||
|
||||
return <ForceWidth forceValue={forceWidthValue}>{value}</ForceWidth>;
|
||||
}
|
||||
|
||||
export function ForceWidth({ children, forceValue }) {
|
||||
const forceWidthValue = forceValue || children;
|
||||
|
||||
return (
|
||||
<span
|
||||
className={'force-width'}
|
||||
style={{ minWidth: getForceWidth(forceWidthValue) }}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
4
src/components/Datatable/index.js
Normal file
4
src/components/Datatable/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
|
||||
export * from './CellForceWidth';
|
||||
@@ -1,7 +1,7 @@
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
export function FormattedMessage({ id }) {
|
||||
return intl.get(id);
|
||||
export function FormattedMessage({ id, values }) {
|
||||
return intl.get(id, values);
|
||||
}
|
||||
|
||||
export function FormattedHTMLMessage({ ...args }) {
|
||||
|
||||
@@ -83,6 +83,8 @@ export * from './Utils/FormatNumber';
|
||||
export * from './Utils/FormatDate';
|
||||
export * from './BankAccounts';
|
||||
export * from './IntersectionObserver'
|
||||
export * from './Datatable/CellForceWidth';
|
||||
export * from './Button';
|
||||
|
||||
const Hint = FieldHint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user