Skip to content

Commit

Permalink
fix(types): fix types and props for Column
Browse files Browse the repository at this point in the history
fix types to use Record and add styles props for Column component
fix stories for Column with styles

resolves #39

Signed-off-by: Niloy Sikdar <niloysikdar30@gmail.com>
  • Loading branch information
niloysikdar committed Jul 3, 2022
1 parent 83d8a9b commit d23db71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/components/Column/Column.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ export const Default = Template.bind({});
Default.args = {
children: <p style={{ margin: '0', fontSize: '30px' }}>Hello World</p>,
align: 'center',
styles: {
column: {
backgroundColor: 'red',
color: 'white',
},
},
};
13 changes: 10 additions & 3 deletions src/components/Column/Column.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import { CSSProperties, ReactNode } from 'react';
import { makeStyles } from '../../utils/makeStyles';

export interface ColumnProps {
children?: ReactNode;
className?: string;
style?: CSSProperties;
styles?: Record<'column', CSSProperties>;
align?: 'left' | 'center' | 'right';
}

const useStyles = makeStyles({
column: {},
});

export const Column = ({
children,
className,
style,
styles,
align = 'left',
}: ColumnProps): JSX.Element => {
const style = useStyles({ classes: styles });

return (
<td className={className} style={style} align={align}>
<td className={className} style={style.column} align={align}>
{children}
</td>
);
Expand Down

0 comments on commit d23db71

Please sign in to comment.