-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c7f402
commit 7048772
Showing
3 changed files
with
73 additions
and
1 deletion.
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
40 changes: 40 additions & 0 deletions
40
packages/react-components/src/docs/foundations/Shadow/ShadowTable.tsx
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,40 @@ | ||
import * as React from 'react'; | ||
|
||
import { handleCopyText } from '../../helpers'; | ||
|
||
import { ShadowShape } from './types'; | ||
|
||
import '../../components/Table/Table.css'; | ||
|
||
interface IColorTableProps { | ||
data: ShadowShape[]; | ||
} | ||
|
||
export const ShadowTable: React.FC<IColorTableProps> = ({ data }) => { | ||
return ( | ||
<table className="sb-unstyled"> | ||
<thead> | ||
<tr> | ||
<th>Enum</th> | ||
<th>Token</th> | ||
<th>Usage</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data.map((shadow) => ( | ||
<tr> | ||
<td onClick={() => handleCopyText(shadow.enum)}> | ||
<div | ||
className="color-example" | ||
style={{ backgroundColor: `var(${shadow.value})` }} | ||
/> | ||
{shadow.enum} | ||
</td> | ||
<td>{shadow.value}</td> | ||
<td>{shadow.desc}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; |
32 changes: 31 additions & 1 deletion
32
packages/react-components/src/docs/foundations/Shadow/constants.ts
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 +1,31 @@ | ||
export const ShadowTokens = {}; | ||
import { ShadowToken, ShadowTokenKey } from '../../../foundations/shadow-token'; | ||
|
||
import { ShadowShape } from './types'; | ||
|
||
export const ShadowTokens: ShadowShape[] = Object.entries(ShadowToken).map( | ||
([key, value]) => ({ | ||
enum: key, | ||
value, | ||
desc: ShadowDescription[key as ShadowTokenKey], | ||
}) | ||
); | ||
|
||
const ShadowDescription: Record<ShadowTokenKey, string> = { | ||
Float: 'Float sample description', | ||
PopOver: 'PopOver sample description', | ||
Modal: 'Modal sample description', | ||
Tooltip: 'Tooltip sample description', | ||
TooltipArrowBottom: 'TooltipArrowBottom sample description', | ||
TooltipArrowTop: 'TooltipArrowTop sample description', | ||
TooltipArrowRight: 'TooltipArrowRight sample description', | ||
TooltipArrowLeft: 'TooltipArrowLeft sample description', | ||
TooltipArrow: 'TooltipArrow sample description', | ||
Focus: 'Focus sample description', | ||
DividerBottom: 'DividerBottom sample description', | ||
DividerTop: 'DividerTop sample description', | ||
DividerBottomLeft: 'DividerBottomLeft sample description', | ||
DividerTopLeft: 'DividerTopLeft sample description', | ||
DividerTopRight: 'DividerTopRight sample description', | ||
DividerBottomRight: 'DividerBottomRight sample description', | ||
MessageBox: 'MessageBox sample description', | ||
}; |