-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update font collection component to accommodate the new font collecti…
…on schema
- Loading branch information
1 parent
3eb68c2
commit 305e85c
Showing
2 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/edit-site/src/components/global-styles/font-library-modal/collection-font-card.js
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,23 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import FontCard from './font-card'; | ||
|
||
function CollectionFontCard( { font, onClick } ) { | ||
// Transform the shape of the data coming from font collection | ||
// into a format understood by the FontCard component and the install related functions. | ||
const fontFamily = { | ||
...font.font_family_settings, | ||
preview: font.preview, | ||
fontFace: font.font_faces.map( ( face ) => ( { | ||
...face.font_face_settings, | ||
preview: face.preview, | ||
} ) ), | ||
}; | ||
|
||
return ( | ||
<FontCard font={ fontFamily } onClick={ () => onClick( fontFamily ) } /> | ||
); | ||
} | ||
|
||
export default CollectionFontCard; |
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