-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new naming for props and styles for rows.
- Loading branch information
1 parent
3ca1b6a
commit 3665f49
Showing
12 changed files
with
159 additions
and
55 deletions.
There are no files selected for viewing
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 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,56 @@ | ||
import React from 'react'; | ||
import styled, { css } from 'styled-components'; | ||
import { ColumnCellStyleProps } from '../../declarations'; | ||
import { | ||
btnResetMixin, | ||
truncateTypoMixin, | ||
typoMixin, | ||
} from '@devoinc/genesys-ui'; | ||
|
||
interface StyledTableCellWrapperProps extends ColumnCellStyleProps { | ||
clickable?: boolean; | ||
paddingVer?: React.CSSProperties['paddingBottom']; | ||
paddingHor?: React.CSSProperties['paddingLeft']; | ||
} | ||
|
||
const alignMap = { | ||
left: 'flex-start', | ||
right: 'flex-end', | ||
center: 'center', | ||
top: 'flex-start', | ||
bottom: 'flex-end', | ||
}; | ||
|
||
export const StyledTableCellWrapper = styled.div<StyledTableCellWrapperProps>` | ||
${({ clickable, theme }) => { | ||
const tokens = theme.cmp.table.cellClickableWrapper; | ||
return ( | ||
clickable && | ||
css` | ||
${btnResetMixin}; | ||
user-select: auto; | ||
outline: none; | ||
cursor: pointer; | ||
transition: background-color ease ${tokens.mutation.transitionDuration}; | ||
&:hover, | ||
&:focus, | ||
&:active { | ||
background-color: ${tokens.color.background.hovered}; | ||
} | ||
` | ||
); | ||
}} | ||
${({ theme, textAlign }) => typoMixin({ theme, textAlign })}; | ||
${({ truncateLine }) => truncateTypoMixin({ lineClamp: truncateLine })} | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
align-items: ${({ align }) => alignMap[align?.vertical || 'center']}; | ||
justify-content: ${({ align }) => alignMap[align?.horizontal || 'left']}; | ||
width: 100%; | ||
height: 100%; | ||
padding: ${({ paddingVer, paddingHor, toEdge }) => | ||
toEdge ? '0' : `${paddingVer} ${paddingHor}`}; | ||
`; |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
import * as React from 'react'; | ||
import { MeasuresConfig, TableStyles } from '../../declarations'; | ||
import { MeasuresConfig, TableVisualOptions } from '../../declarations'; | ||
|
||
interface TableContextProps { | ||
styles: TableStyles; | ||
visualOptions: TableVisualOptions; | ||
measures: MeasuresConfig; | ||
} | ||
|
||
export const TableContext = React.createContext<TableContextProps>({ | ||
density: 'default', | ||
row: { height: 'md' }, | ||
wrapper: { | ||
maxHeight: 'none', | ||
visualOptions: { | ||
density: 'default', | ||
row: { height: 'md' }, | ||
striped: false, | ||
wrapper: { | ||
maxHeight: 'none', | ||
}, | ||
}, | ||
measures: { | ||
head: { height: 36 }, | ||
row: { | ||
height: { | ||
md: 36, | ||
lg: 60, | ||
xl: 72, | ||
xxl: 84, | ||
xxxl: 96, | ||
}, | ||
}, | ||
cell: { | ||
horPad: 12, | ||
verPad: 8, | ||
}, | ||
}, | ||
}); |
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 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
Oops, something went wrong.