Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAY-173] Convert Visual Guideline Display Partial to React and Allo…
…w Screen Size Global Props (#1924) * Converting title kit to ts (#1872) * Removed flow and Renamed file * Updated Types * Removed JSX file extentions from imports * Fix syntax error * Fix tests Co-authored-by: Erica Winne <erica.winne@powerhrg.com> * Converting caption to tsx (#1874) * Started Converting * Rename file to TSX and Updated types * Added/Joined & GlobalProps * Merge Master * Changed back default blank string Co-authored-by: Erica Winne <erica.winne@powerhrg.com> * Added logic to example template to allow for screen sizes and added display component * Completed display partial to react * Code clean-up * More clean-up and fixed spacing * Fixed spacing * Fixed text size in table Co-authored-by: Stephen Marshall <smarshall1980@gmail.com> Co-authored-by: Erica Winne <erica.winne@powerhrg.com>
- Loading branch information
1 parent
f327e61
commit 21f3545
Showing
5 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
playbook-website/app/javascript/components/VisualGuidelines/Examples/Display.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,83 @@ | ||
import React from 'react' | ||
import { | ||
Body, | ||
Caption, | ||
Table, | ||
Title, | ||
} from 'playbook-ui' | ||
|
||
import Example from '../Templates/Example' | ||
|
||
const screenSizeProps = { | ||
display: ['xs', 'sm', 'md', 'lg', 'xl'] | ||
} | ||
|
||
const UTILITY_CLASSES = [ | ||
{size: 'xs', media: '@media screen and (max-width: 575px)', class: '.display_xs_hidden', properties: 'display: hidden !important'}, | ||
{size: 'sm', media: '@media screen and (max-width: 576px)', class: '.display_sm_block', properties: 'display: block !important'}, | ||
{size: 'md', media: '@media screen and (max-width: 768px)', class: '.display_md_inline_block', properties: 'display: inline-block !important'}, | ||
{size: 'lg', media: '@media screen and (max-width: 992px)', class: '.display_lg_inline', properties: 'display: inline !important'}, | ||
{size: 'xl', media: '@media screen and (max-width: 1200px)', class: '.display_xl_flex', properties: 'display: flex !important'}, | ||
] | ||
|
||
const DISPLAY_VALUES = ['inline', 'flex', 'inline_flex', 'inline_block', 'block', 'none'] | ||
|
||
const Display = ({example}: {example: string}) => ( | ||
<React.Fragment> | ||
<Example | ||
example={example} | ||
globalProps={{ | ||
display: DISPLAY_VALUES | ||
}} | ||
screenSizes={screenSizeProps} | ||
title='Display' | ||
/> | ||
<Title | ||
marginBottom='xs' | ||
paddingTop='sm' | ||
size={4} | ||
text='Utility Classes' | ||
/> | ||
<Body | ||
text='Just want the raw classes? We got you. All of our global props are simple CSS utilities available through classes.' | ||
marginBottom='sm' | ||
/> | ||
<Caption | ||
text='Visual Guide' | ||
marginBottom='sm' | ||
/> | ||
<Table | ||
shadow='deep' | ||
size='sm' | ||
> | ||
<thead> | ||
<tr> | ||
<th>{'Screen Size'}</th> | ||
<th>{'@Media Screen'}</th> | ||
<th>{'Class'}</th> | ||
<th>{'Properties'}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{UTILITY_CLASSES.map((utilityClass: {[key: string]: string}) => ( | ||
<tr> | ||
<td> | ||
{utilityClass.size} | ||
</td> | ||
<td> | ||
{utilityClass.media} | ||
</td> | ||
<td> | ||
{utilityClass.class} | ||
</td> | ||
<td> | ||
{utilityClass.properties} | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</Table> | ||
</React.Fragment> | ||
) | ||
|
||
export default Display |
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