@@ -19,7 +19,7 @@ import {
1919/**
2020 * WordPress dependencies
2121 */
22- import { __ } from '@wordpress/i18n'
22+ import { __ , sprintf } from '@wordpress/i18n'
2323// import { RawHTML } from '@wordpress/element'
2424// import { createBlock, serialize } from '@wordpress/blocks'
2525
@@ -139,16 +139,20 @@ const StyleGuide = props => {
139139 const {
140140 colors,
141141 colorSchemes = DUMMY_COLOR_SCHEMES ,
142+ typography = {
143+ desktop : [ ] , tablet : [ ] , mobile : [ ] ,
144+ } ,
145+ designSystemStyles = '' ,
142146 } = designSystem
143147
144148 return (
145149 < >
146150 < div className = "ugb-style-guide" >
147151 < div className = "ugb-style-guide__content" ref = { contentRef } >
148-
152+ < style > { designSystemStyles } </ style >
149153 < h1 className = "ugb-style-guide__section-title ugb-style-guide__title" > { __ ( 'Colors' , i18n ) } </ h1 >
150154
151- { /* TODO: Kae: the color schemes should always output at least 2 entries: 1 base color scheme and 1 background color scheme even at their default states. */ }
155+ { /* TODO: Kae: the color schemes should always output at least 2 entries: 1 base color scheme and 1 background color scheme even at their default states. className="ugb-style-guide__typography-preview" data-device="desktop" */ }
152156 { colorSchemes && < >
153157 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Color Schemes' , i18n ) } </ h2 >
154158 < div className = "ugb-style-guide__columns ugb-style-guide__color-schemes" >
@@ -158,10 +162,10 @@ const StyleGuide = props => {
158162 < h2 className = "ugb-style-guide__color-scheme-title ugb-style-guide__title ugb-style-guide__color-label" > { colorScheme . name } </ h2 >
159163 < div className = "ugb-style-guide__color-scheme ugb-style-guide__color-container" style = { { backgroundColor : colorScheme . backgroundColor . color } } >
160164 { /* TODO: Kae: the fonts and sizes here should be based on the design system */ }
161- < div className = "ugb-style-guide__color-scheme__subtitle" style = { { color : colorScheme . accentColor . color } } > { __ ( 'Subtitle' , i18n ) } </ div >
162- < div className = "ugb-style-guide__color-scheme__heading" style = { { color : colorScheme . headingColor . color } } > { __ ( 'Headings' , i18n ) } </ div >
165+ < div className = "ugb-style-guide__color-scheme__subtitle stk-subtitle ugb-style-guide__typography-preview" data-device = "desktop " style = { { color : colorScheme . accentColor . color } } > { __ ( 'Subtitle' , i18n ) } </ div >
166+ < h2 className = "ugb-style-guide__color-scheme__heading ugb-style-guide__typography-preview" data-device = "desktop" style = { { color : colorScheme . headingColor . color } } > { __ ( 'Headings' , i18n ) } </ h2 >
163167
164- < div className = "ugb-style-guide__color-scheme__body" style = { { color : colorScheme . textColor . color } } >
168+ < p className = "ugb-style-guide__color-scheme__body ugb-style-guide__typography-preview" data-device = "desktop " style = { { color : colorScheme . textColor . color } } >
165169 { LONG_TEXT [ i % 6 ] }
166170
167171 { LONG_TEXT [ ( i + 1 ) % 6 ] }
@@ -175,7 +179,7 @@ const StyleGuide = props => {
175179 } } >
176180 { __ ( 'Link' , i18n ) }
177181 </ a >
178- </ div >
182+ </ p >
179183
180184 { /* TODO: Kae: the button looks here should be based on the design system */ }
181185 < div className = "ugb-style-guide__color-scheme__links" >
@@ -185,14 +189,14 @@ const StyleGuide = props => {
185189 color : colorScheme . buttonTextColor . color ,
186190 '--hover-background-color' : colorScheme . buttonColor . hoverColor || colorScheme . buttonColor . color ,
187191 '--hover-color' : colorScheme . buttonTextColor . hoverColor || colorScheme . buttonTextColor . color ,
188- } } > { __ ( 'Button' , i18n ) } </ button >
192+ } } > < span className = "stk-button__inner-text ugb-style-guide__typography-preview" data-device = "desktop" > { __ ( 'Button' , i18n ) } </ span > </ button >
189193
190194 < button className = "ugb-style-guide__color-scheme__button--outline" style = { {
191195 borderColor : colorScheme . buttonOutlineColor . color ,
192196 color : colorScheme . buttonOutlineColor . color ,
193197 '--hover-border-color' : colorScheme . buttonOutlineColor . hoverColor || colorScheme . buttonOutlineColor . color ,
194198 '--hover-color' : colorScheme . buttonOutlineColor . hoverColor || colorScheme . buttonOutlineColor . color ,
195- } } > { __ ( 'Button' , i18n ) } </ button >
199+ } } > < span className = "stk-button__inner-text ugb-style-guide__typography-preview" data-device = "desktop" > { __ ( 'Button' , i18n ) } </ span > </ button >
196200
197201 </ div >
198202 </ div >
@@ -242,140 +246,78 @@ const StyleGuide = props => {
242246
243247 < div className = "ugb-style-guide__column" >
244248 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Desktop' , i18n ) } </ h2 >
245- < div className = "ugb-style-guide__typography-container" >
246- < h1 > { __ ( 'Heading 1' , i18n ) } </ h1 >
247- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
248- </ div >
249- < div className = "ugb-style-guide__typography-container" >
250- < h2 > { __ ( 'Heading 2' , i18n ) } </ h2 >
251- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
252- </ div >
253- < div className = "ugb-style-guide__typography-container" >
254- < h3 > { __ ( 'Heading 3' , i18n ) } </ h3 >
255- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
256- </ div >
257- < div className = "ugb-style-guide__typography-container" >
258- < h4 > { __ ( 'Heading 4' , i18n ) } </ h4 >
259- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
260- </ div >
261- < div className = "ugb-style-guide__typography-container" >
262- < h5 > { __ ( 'Heading 5' , i18n ) } </ h5 >
263- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
264- </ div >
265- < div className = "ugb-style-guide__typography-container" >
266- < h6 > { __ ( 'Heading 6' , i18n ) } </ h6 >
267- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
268- </ div >
269- < div className = "ugb-style-guide__typography-container" >
270- < p > { __ ( 'Body' , i18n ) } </ p >
271- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
272- </ div >
273- < div className = "ugb-style-guide__typography-container" >
274- < p > { __ ( 'Subtitle' , i18n ) } </ p >
275- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
276- </ div >
277- < div className = "ugb-style-guide__typography-container" >
278- < p > { __ ( 'Button' , i18n ) } </ p >
279- < div className = "ugb-style-guide__typography-label" > System Font / Bold / 16px</ div >
280- </ div >
249+ { typography . desktop . length > 0 && typography . desktop . map ( ( [ element , description ] , i ) => {
250+ const Tag = element . startsWith ( 'h' ) ? element : 'p'
251+ const classname = i === 7 ? 'stk-subtitle' : i === 8 ? 'stk-button__inner-text' : ''
252+
253+ const label = i < 6 ? sprintf ( __ ( 'Heading %d' , i18n ) , i + 1 )
254+ : i === 6 ? __ ( 'Body' , i18n )
255+ : i === 7 ? __ ( 'Subtitle' , i18n )
256+ : __ ( 'Button' , i18n )
257+
258+ return (
259+ < div key = { i } className = "ugb-style-guide__typography-container" >
260+ < Tag className = { `ugb-style-guide__typography-preview ${ classname } ` } data-device = "desktop" > { label } </ Tag >
261+ < div className = "ugb-style-guide__typography-label" > { description } </ div >
262+ </ div >
263+ )
264+ } ) }
281265 </ div >
282266
283267 < div className = "ugb-style-guide__column" >
284268 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Tablet' , i18n ) } </ h2 >
285- < div className = "ugb-style-guide__typography-container" >
286- < h1 > { __ ( 'Heading 1' , i18n ) } </ h1 >
287- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
288- </ div >
289- < div className = "ugb-style-guide__typography-container" >
290- < h2 > { __ ( 'Heading 2' , i18n ) } </ h2 >
291- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
292- </ div >
293- < div className = "ugb-style-guide__typography-container" >
294- < h3 > { __ ( 'Heading 3' , i18n ) } </ h3 >
295- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
296- </ div >
297- < div className = "ugb-style-guide__typography-container" >
298- < h4 > { __ ( 'Heading 4' , i18n ) } </ h4 >
299- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
300- </ div >
301- < div className = "ugb-style-guide__typography-container" >
302- < h5 > { __ ( 'Heading 5' , i18n ) } </ h5 >
303- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
304- </ div >
305- < div className = "ugb-style-guide__typography-container" >
306- < h6 > { __ ( 'Heading 6' , i18n ) } </ h6 >
307- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
308- </ div >
309- < div className = "ugb-style-guide__typography-container" >
310- < p > { __ ( 'Body' , i18n ) } </ p >
311- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
312- </ div >
313- < div className = "ugb-style-guide__typography-container" >
314- < p > { __ ( 'Subtitle' , i18n ) } </ p >
315- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
316- </ div >
317- < div className = "ugb-style-guide__typography-container" >
318- < p > { __ ( 'Button' , i18n ) } </ p >
319- < div className = "ugb-style-guide__typography-label" > System Font / Bold / 16px</ div >
320- </ div >
269+ { typography . tablet . length > 0 && typography . tablet . map ( ( [ element , description ] , i ) => {
270+ const Tag = element . startsWith ( 'h' ) ? element : 'p'
271+ const classname = i === 7 ? 'stk-subtitle' : i === 8 ? 'stk-button__inner-text' : ''
272+ const label = i < 6 ? sprintf ( __ ( 'Heading %d' , i18n ) , i + 1 )
273+ : i === 6 ? __ ( 'Body' , i18n )
274+ : i === 7 ? __ ( 'Subtitle' , i18n )
275+ : __ ( 'Button' , i18n )
276+
277+ return (
278+ < div key = { i } className = "ugb-style-guide__typography-container" >
279+ < Tag className = { `ugb-style-guide__typography-preview ${ classname } ` } data-device = "tablet" > { label } </ Tag >
280+ < div className = "ugb-style-guide__typography-label" > { description } </ div >
281+ </ div >
282+ )
283+ } ) }
321284 </ div >
322285
323286 < div className = "ugb-style-guide__column" >
324287 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Mobile' , i18n ) } </ h2 >
325- < div className = "ugb-style-guide__typography-container" >
326- < h1 > { __ ( 'Heading 1' , i18n ) } </ h1 >
327- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
328- </ div >
329- < div className = "ugb-style-guide__typography-container" >
330- < h2 > { __ ( 'Heading 2' , i18n ) } </ h2 >
331- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
332- </ div >
333- < div className = "ugb-style-guide__typography-container" >
334- < h3 > { __ ( 'Heading 3' , i18n ) } </ h3 >
335- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
336- </ div >
337- < div className = "ugb-style-guide__typography-container" >
338- < h4 > { __ ( 'Heading 4' , i18n ) } </ h4 >
339- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
340- </ div >
341- < div className = "ugb-style-guide__typography-container" >
342- < h5 > { __ ( 'Heading 5' , i18n ) } </ h5 >
343- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
344- </ div >
345- < div className = "ugb-style-guide__typography-container" >
346- < h6 > { __ ( 'Heading 6' , i18n ) } </ h6 >
347- < div className = "ugb-style-guide__typography-label" > DM Sans / Bold / 36px</ div >
348- </ div >
349- < div className = "ugb-style-guide__typography-container" >
350- < p > { __ ( 'Body' , i18n ) } </ p >
351- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
352- </ div >
353- < div className = "ugb-style-guide__typography-container" >
354- < p > { __ ( 'Subtitle' , i18n ) } </ p >
355- < div className = "ugb-style-guide__typography-label" > System Font / Normal / 16px</ div >
356- </ div >
357- < div className = "ugb-style-guide__typography-container" >
358- < p > { __ ( 'Button' , i18n ) } </ p >
359- < div className = "ugb-style-guide__typography-label" > System Font / Bold / 16px</ div >
360- </ div >
288+ { typography . mobile . length > 0 && typography . mobile . map ( ( [ element , description ] , i ) => {
289+ const Tag = element . startsWith ( 'h' ) ? element : 'p'
290+ const classname = i === 7 ? 'stk-subtitle' : i === 8 ? 'stk-button__inner-text' : ''
291+ const label = i < 6 ? sprintf ( __ ( 'Heading %d' , i18n ) , i + 1 )
292+ : i === 6 ? __ ( 'Body' , i18n )
293+ : i === 7 ? __ ( 'Subtitle' , i18n )
294+ : __ ( 'Button' , i18n )
295+
296+ return (
297+ < div key = { i } className = "ugb-style-guide__typography-container" >
298+ < Tag className = { `ugb-style-guide__typography-preview ${ classname } ` } data-device = "mobile" > { label } </ Tag >
299+ < div className = "ugb-style-guide__typography-label" > { description } </ div >
300+ </ div >
301+ )
302+ } ) }
361303 </ div >
362304 </ div >
363305
364306 < div className = "ugb-style-guide__columns ugb-style-guide__typography-body" >
365307 < div className = "ugb-style-guide__column" >
366308 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Desktop' , i18n ) } </ h2 >
367- < h2 > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
368- < p > { LONG_TEXT [ 0 ] } { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } </ p >
309+ < h2 className = "ugb-style-guide__typography-preview" data-device = "desktop" > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
310+ < p className = "ugb-style-guide__typography-preview" data-device = "desktop" > { LONG_TEXT [ 0 ] } { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } </ p >
369311 </ div >
370312 < div className = "ugb-style-guide__column" >
371313 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Tablet' , i18n ) } </ h2 >
372- < h2 > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
373- < p > { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } { LONG_TEXT [ 3 ] } </ p >
314+ < h2 className = "ugb-style-guide__typography-preview" data-device = "tablet" > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
315+ < p className = "ugb-style-guide__typography-preview" data-device = "tablet" > { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } { LONG_TEXT [ 3 ] } </ p >
374316 </ div >
375317 < div className = "ugb-style-guide__column" >
376318 < h2 className = "ugb-style-guide__section-subheading ugb-style-guide__title" > { __ ( 'Mobile' , i18n ) } </ h2 >
377- < h2 > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
378- < p > { LONG_TEXT [ 2 ] } { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } </ p >
319+ < h2 className = "ugb-style-guide__typography-preview" data-device = "mobile" > { __ ( 'Built on the Moments Between' , i18n ) } </ h2 >
320+ < p className = "ugb-style-guide__typography-preview" data-device = "mobile" > { LONG_TEXT [ 2 ] } { LONG_TEXT [ 1 ] } { LONG_TEXT [ 2 ] } </ p >
379321 </ div >
380322 </ div >
381323
0 commit comments