-
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.
Merge branch 'master' of github.com:DevoInc/genesys-ui
- Loading branch information
Showing
21 changed files
with
251 additions
and
134 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
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
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,72 @@ | ||
import * as React from 'react'; | ||
import { | ||
MeasuresConfig, | ||
TableVisualOptions, | ||
TextsType, | ||
} from '../../declarations'; | ||
|
||
interface TableContextProps { | ||
visualOptions?: TableVisualOptions; | ||
texts?: TextsType; | ||
measures: MeasuresConfig; | ||
} | ||
|
||
interface TableContextProviderProps { | ||
children: React.ReactNode; | ||
value: TableContextProps; | ||
} | ||
|
||
const defaultTableContext: TableContextProps = { | ||
visualOptions: { | ||
density: 'default', | ||
rowHeight: 'md', | ||
striped: false, | ||
maxHeight: 'none', | ||
}, | ||
texts: { | ||
general: { | ||
noData: 'No data available.', | ||
noResults: 'No results found.', | ||
}, | ||
cell: { | ||
editTooltip: 'Double click to edit this cell', | ||
editSaveTooltip: 'Click outside to save the changes', | ||
}, | ||
editor: { | ||
editorTextLabel: 'Edit this text content.', | ||
}, | ||
}, | ||
measures: { | ||
head: { height: 36 }, | ||
row: { | ||
height: { | ||
md: 36, | ||
lg: 60, | ||
xl: 72, | ||
xxl: 84, | ||
xxxl: 96, | ||
}, | ||
}, | ||
cell: { | ||
horPad: 12, | ||
verPad: 8, | ||
}, | ||
}, | ||
}; | ||
|
||
export const TableContext = | ||
React.createContext<TableContextProps>(defaultTableContext); | ||
|
||
export const TableContextProvider = ({ | ||
children, | ||
value, | ||
}: TableContextProviderProps) => { | ||
const [context] = React.useState({ | ||
...defaultTableContext, | ||
...value, | ||
}); | ||
|
||
return ( | ||
<TableContext.Provider value={context}>{children}</TableContext.Provider> | ||
); | ||
}; |
Oops, something went wrong.