-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
font-variant.js
53 lines (49 loc) · 1.1 KB
/
font-variant.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* WordPress dependencies
*/
import {
__experimentalText as Text,
__experimentalVStack as VStack,
__experimentalHStack as HStack,
CheckboxControl,
} from '@wordpress/components';
/**
* Internal dependencies
*/
import FontFaceDemo from './font-demo';
function FontVariant( {
fontFace,
variantName,
checked,
onClick,
text,
actionHandler,
} ) {
const { fontStyle, fontWeight } = fontFace;
const displayVariantName = variantName || `${ fontWeight } ${ fontStyle }`;
return (
<div className="font-library-modal__font-variant">
<VStack spacing={ 1 }>
<HStack justify="flex-start" alignment="top">
{ !! actionHandler ? (
actionHandler
) : (
<CheckboxControl
checked={ checked }
onChange={ onClick }
/>
) }
{ typeof displayVariantName === 'string' ? (
<Text>{ displayVariantName }</Text>
) : (
displayVariantName
) }
</HStack>
<div className="font-library-modal__font-variant_demo-wrapper">
<FontFaceDemo fontFace={ fontFace } text={ text } />
</div>
</VStack>
</div>
);
}
export default FontVariant;