-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* convert to typescript * Change suffix * Radius optional
- Loading branch information
Showing
13 changed files
with
204 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { HTMLAttributes } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const TableBase = styled.tbody`` | ||
|
||
type Props = HTMLAttributes<HTMLTableSectionElement> | ||
|
||
export const Body = ({ children, ...props }: Props): JSX.Element => { | ||
return <TableBase {...props}>{children}</TableBase> | ||
} | ||
|
||
Body.displayName = 'eds-table-body' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { FunctionComponent } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const TableBase = styled.tr`` | ||
|
||
type Props = React.HTMLAttributes<HTMLTableRowElement> | ||
|
||
export const Row: FunctionComponent<Props> = (props) => { | ||
const { children } = props | ||
|
||
return <TableBase {...props}>{children}</TableBase> | ||
} | ||
|
||
Row.displayName = 'EdsTableRow' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import tableTokens from '@equinor/eds-tokens/components/table/table.json' | ||
import type { | ||
Border, | ||
Clickbound, | ||
Spacing, | ||
Typography, | ||
} from '@equinor/eds-tokens' | ||
|
||
const { header, cell } = tableTokens | ||
|
||
type Field = { | ||
height: string | ||
background: string | ||
borders: { | ||
outline: Border | ||
} | ||
text: { | ||
color: string | ||
typography: Typography | ||
colorPlaceholder: string | ||
} | ||
spacings: Spacing | ||
} | ||
|
||
export type TableCell = { | ||
height: string | ||
background: string | ||
borders: { | ||
bottom: Border | ||
} | ||
text?: { | ||
color: string | ||
typography: Typography | ||
} | ||
spacings: Spacing | ||
clickbound: Clickbound | ||
field?: Field | ||
active: { | ||
background: string | ||
color?: string | ||
typography?: Typography | ||
borders: { | ||
bottom: Border | ||
} | ||
field?: Field | ||
} | ||
disabled: { | ||
background: string | ||
color?: string | ||
typography?: Typography | ||
borders: { | ||
bottom: Border | ||
} | ||
field?: Field | ||
} | ||
focus: { | ||
type?: string | ||
color?: string | ||
width?: string | ||
gap?: string | ||
field?: Field | ||
} | ||
hover: { | ||
background: string | ||
field?: Field | ||
} | ||
} | ||
|
||
type Variants = { | ||
header: { | ||
text: TableCell | ||
} | ||
cell: { | ||
text: TableCell | ||
numeric: TableCell | ||
icon: TableCell | ||
input: TableCell | ||
} | ||
} | ||
|
||
const variants: Variants = { | ||
header: { text: header.text }, | ||
cell: { | ||
text: cell.text, | ||
numeric: cell.monospaced_numeric, | ||
icon: cell.icon, | ||
input: cell.input, | ||
}, | ||
} | ||
|
||
export const getTokens = (as: string, variant: string): TableCell => { | ||
switch (as) { | ||
case 'th': | ||
return variants.header[variant] as TableCell | ||
case 'td': | ||
default: | ||
return variants.cell[variant] as TableCell | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { FunctionComponent, HTMLAttributes } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const TableBase = styled.table` | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
` | ||
|
||
type Props = HTMLAttributes<HTMLTableElement> | ||
|
||
export const Table: FunctionComponent<Props> = ({ children, ...props }) => { | ||
return <TableBase {...props}>{children}</TableBase> | ||
} | ||
|
||
Table.displayName = 'EdsTable' |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.