Skip to content

Commit

Permalink
create basic styles
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvanhoutte committed Jul 25, 2020
1 parent bbeaead commit a1aaac0
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/components/Table/Table.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.table {
width: 100%;
border-collapse: separate;
border-spacing: 0 8px;
}
17 changes: 16 additions & 1 deletion src/components/Table/TableCell/TableCell.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
cell {
.cell {
text-align: left;
height: 32px;
line-height: 32px;
padding: 0 14px;
}

.cell:hover ~ .cell {
background-color: var(--color-primary-hover);
}

.cell:first-child {
border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}

.cell:last-child {
border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}
11 changes: 8 additions & 3 deletions src/components/Table/TableCell/TableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import styles from './TableCell.module.css';
type Props = {
className?: string;
children?: React.ReactNode;
colSpan?: number;
};

const TableCell: React.FC<Props> = ({ className, children }: Props) => {
const tableClassNames = classNames(styles.cell, className);
const TableCell: React.FC<Props> = ({ className, children, colSpan }: Props) => {
const tableClassNames = classNames(styles.cell, styles.row, className);

return <td className={tableClassNames}> {children} </td>;
return (
<td colSpan={colSpan} className={tableClassNames}>
{children}
</td>
);
};

export default TableCell;
2 changes: 1 addition & 1 deletion src/components/Table/TableHeader/TableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TableHeader: React.FC<Props> = ({ className, children }: Props) => {

return (
<thead className={tableClassNames}>
<tr>{children}</tr>
<tr className={styles.headerRow}>{children}</tr>
</thead>
);
};
Expand Down
15 changes: 14 additions & 1 deletion src/components/Table/TableHeaderCell/TableHeaderCell.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
headerCell {
.headerCell {
background-color: var(--color-primary-hover);
text-align: left;
height: 36px;
line-height: 36px;
padding: 0 14px;
color: var(--font-color-sub)
}

.headerCell:first-child {
border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}

.headerCell:last-child {
border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}
9 changes: 7 additions & 2 deletions src/components/Table/TableHeaderCell/TableHeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import styles from './TableHeaderCell.module.css';
type Props = {
className?: string;
children?: React.ReactNode;
colSpan?: number;
};

const TableHeaderCell: React.FC<Props> = ({ className, children }: Props) => {
const TableHeaderCell: React.FC<Props> = ({ className, children, colSpan }: Props) => {
const tableHeaderCellClassNames = classNames(styles.headerCell, className);

return <th className={tableHeaderCellClassNames}> {children} </th>;
return (
<th colSpan={colSpan} className={tableHeaderCellClassNames}>
{children}
</th>
);
};

export default TableHeaderCell;
7 changes: 7 additions & 0 deletions src/components/Table/TableRow/TableRow.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.row:nth-of-type(even) td {
background-color: var(--color-primary);
}

.row:hover td {
background-color: var(--color-primary-hover);
}

0 comments on commit a1aaac0

Please sign in to comment.