Skip to content

Commit

Permalink
feat: Table 기본 CSS 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 11, 2024
1 parent de68ea5 commit 14977fe
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 27 deletions.
20 changes: 20 additions & 0 deletions packages/wow-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,31 @@
"require": "./dist/Table.cjs",
"import": "./dist/Table.js"
},
"./TableBody": {
"types": "./dist/components/Table/TableBody.d.ts",
"require": "./dist/TableBody.cjs",
"import": "./dist/TableBody.js"
},
"./TableCell": {
"types": "./dist/components/Table/TableCell.d.ts",
"require": "./dist/TableCell.cjs",
"import": "./dist/TableCell.js"
},
"./TableContainer": {
"types": "./dist/components/Table/TableContainer.d.ts",
"require": "./dist/TableContainer.cjs",
"import": "./dist/TableContainer.js"
},
"./TableHeader": {
"types": "./dist/components/Table/TableHeader.d.ts",
"require": "./dist/TableHeader.cjs",
"import": "./dist/TableHeader.js"
},
"./TableRow": {
"types": "./dist/components/Table/TableRow.d.ts",
"require": "./dist/TableRow.cjs",
"import": "./dist/TableRow.js"
},
"./Switch": {
"types": "./dist/components/Switch/index.d.ts",
"require": "./dist/Switch.cjs",
Expand Down
4 changes: 4 additions & 0 deletions packages/wow-ui/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export default {
TextField: "./src/components/TextField",
TextButton: "./src/components/TextButton",
Table: "./src/components/Table",
TableBody: "./src/components/Table/TableBody",
TableCell: "./src/components/Table/TableCell",
TableContainer: "./src/components/Table/TableContainer",
TableHeader: "./src/components/Table/TableHeader",
TableRow: "./src/components/Table/TableRow",
Switch: "./src/components/Switch",
Stepper: "./src/components/Stepper",
BlueSpinner: "./src/components/Spinner/BlueSpinner",
Expand Down
29 changes: 11 additions & 18 deletions packages/wow-ui/src/components/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,21 @@ export const Primary: Story = {
return (
<TableContainer>
<Table>
<TableHeader>
<TableRow>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
</TableRow>
</TableHeader>
<TableRow>
<TableHeader>학번</TableHeader>
<TableHeader>이름</TableHeader>
<TableHeader>전화번호</TableHeader>
</TableRow>
<TableBody>
<TableRow>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
</TableRow>
<TableRow>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>C000000</TableCell>
<TableCell>가나다</TableCell>
<TableCell>0100000000</TableCell>
</TableRow>
<TableRow>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>하이루</TableCell>
<TableCell>C000000</TableCell>
<TableCell>가나다</TableCell>
<TableCell>0100000000</TableCell>
</TableRow>
</TableBody>
</Table>
Expand Down
10 changes: 7 additions & 3 deletions packages/wow-ui/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { styled } from "@styled-system/jsx";
import type { PropsWithChildren } from "react";
import type { StyleProps } from "@styled-system/types";
import type { CSSProperties, PropsWithChildren } from "react";
import { forwardRef } from "react";

interface TableProps extends PropsWithChildren {}
interface TableProps extends PropsWithChildren {
style?: CSSProperties;
}

const Table = forwardRef<HTMLTableElement, TableProps>((props, ref) => {
const { children } = props;
const { children, ...rest } = props;
return (
<styled.table
aria-labelledby="table"
borderCollapse="collapse"
ref={ref}
width="100%"
{...rest}
>
{children}
</styled.table>
Expand Down
2 changes: 1 addition & 1 deletion packages/wow-ui/src/components/Table/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
(props, ref) => {
const { children } = props;
return (
<styled.tbody ref={ref} {...props}>
<styled.tbody ref={ref} {...props} textAlign="start">
{children}
</styled.tbody>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/wow-ui/src/components/Table/TableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const TableCell = forwardRef<HTMLTableDataCellElement, TableCellProps>(
(props, ref) => {
const { children } = props;
return (
<styled.td ref={ref} {...props}>
<styled.td maxWidth="100%" paddingX="sm" ref={ref} {...props}>
{children}
</styled.td>
);
Expand Down
6 changes: 4 additions & 2 deletions packages/wow-ui/src/components/Table/TableContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { styled } from "@styled-system/jsx";
import type { PropsWithChildren } from "react";
import type { CSSProperties, PropsWithChildren } from "react";
import { forwardRef } from "react";

interface TableContainerProps extends PropsWithChildren {}
interface TableContainerProps extends PropsWithChildren {
style?: CSSProperties;
}

const TableContainer = forwardRef<HTMLDivElement, TableContainerProps>(
(props, ref) => {
Expand Down
13 changes: 12 additions & 1 deletion packages/wow-ui/src/components/Table/TableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ const TableHeader = forwardRef<HTMLTableHeaderCellElement, TableHeaderProps>(
(props, ref) => {
const { children } = props;
return (
<styled.th ref={ref} {...props}>
<styled.th
alignItems="center"
backgroundColor="backgroundAlternative"
color="sub"
height="44px"
letterSpacing="wider"
paddingX="sm"
ref={ref}
textAlign="start"
textStyle="label2"
{...props}
>
{children}
</styled.th>
);
Expand Down
9 changes: 8 additions & 1 deletion packages/wow-ui/src/components/Table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
(props, ref) => {
const { children } = props;
return (
<styled.tr ref={ref} {...props}>
<styled.tr
color="textBlack"
height="44px"
minWidth="100%"
ref={ref}
textStyle="body2"
{...props}
>
{children}
</styled.tr>
);
Expand Down

0 comments on commit 14977fe

Please sign in to comment.