Skip to content

Commit

Permalink
feat: added columnDivider styling
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Jul 18, 2023
1 parent 0c06e1c commit c4d59a3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
16 changes: 16 additions & 0 deletions docs/stories/aIntro.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,19 @@ export const StyledCells = {
},
},
};

export const StyleColumnDivider = {
args: {
...Primary.args,
enableSelection: false,
enableColumnSelection: false,
enableExport: false,
styles: {
columnDivider: {
'&:after': {
display: 'none',
},
},
},
},
};
36 changes: 22 additions & 14 deletions src/components/resizeHandle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { HTMLProps } from 'react';
import type React from 'react';
import type { HTMLProps } from 'react';
import { useTheme } from '../hooks/useTheme';
import { useColumnContext, useTableContext } from '../misc/tableContext';

export function ResizeHandle() {
Expand Down Expand Up @@ -60,23 +61,30 @@ export function ResizeHandleView({
enabled,
...props
}: HTMLProps<HTMLDivElement> & { enabled?: boolean }) {
const className = useTheme((theme) => theme.classes?.columnDivider);
const styles = useTheme((theme) => theme.styles?.columnDivider);

return (
<div
css={{
alignSelf: 'stretch',
padding: '0 5px',
cursor: enabled ? 'col-resize' : 'initial',
display: 'flex',
alignItems: 'center',
className={className}
css={[
{
alignSelf: 'stretch',
padding: '0 5px',
cursor: enabled ? 'col-resize' : 'initial',
display: 'flex',
alignItems: 'center',

'&:after': {
content: '""',
width: 1,
height: '1.5em',
background: '#c9cfda',
transition: 'transform 300ms',
'&:after': {
content: '""',
width: 1,
height: '1.5em',
background: '#c9cfda',
transition: 'transform 300ms',
},
},
}}
styles,
]}
{...props}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface TableTheme<T = unknown> {
oddCell?: string;
popover?: string;
popoverBackdrop?: string;
columnDivider?: string;
};
styles?: {
table?: CSSObject;
Expand All @@ -59,6 +60,7 @@ export interface TableTheme<T = unknown> {
cell?: CSSObject | FunctionWithDeps<(item: T, index: number) => CSSObject>;
evenCell?: CSSObject;
oddCell?: CSSObject;
columnDivider?: CSSObject;
};
/** Define components to be used in the table. */
components: {
Expand Down

0 comments on commit c4d59a3

Please sign in to comment.