forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style Book: Add color tab (WordPress#65692)
Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: ramonjd <[email protected]>
- Loading branch information
1 parent
b0db4f8
commit 5437114
Showing
10 changed files
with
455 additions
and
85 deletions.
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
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
44 changes: 44 additions & 0 deletions
44
packages/edit-site/src/components/style-book/color-examples.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,44 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import clsx from 'clsx'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalGrid as Grid } from '@wordpress/components'; | ||
import { View } from '@wordpress/primitives'; | ||
import { | ||
getColorClassName, | ||
__experimentalGetGradientClass, | ||
} from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { Color, Gradient } from './types'; | ||
|
||
const ColorExamples = ( { colors, type } ): JSX.Element | null => { | ||
if ( ! colors ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Grid columns={ 2 } rowGap={ 8 } columnGap={ 16 }> | ||
{ colors.map( ( color: Color | Gradient ) => { | ||
const className = | ||
type === 'gradients' | ||
? __experimentalGetGradientClass( color.slug ) | ||
: getColorClassName( 'background-color', color.slug ); | ||
const classes = clsx( | ||
'edit-site-style-book__color-example', | ||
className | ||
); | ||
|
||
return <View key={ color.slug } className={ classes } />; | ||
} ) } | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default ColorExamples; |
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
53 changes: 53 additions & 0 deletions
53
packages/edit-site/src/components/style-book/duotone-examples.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,53 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalGrid as Grid } from '@wordpress/components'; | ||
import { View } from '@wordpress/primitives'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { Duotone } from './types'; | ||
|
||
const DuotoneExamples = ( { duotones } ): JSX.Element | null => { | ||
if ( ! duotones ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Grid columns={ 2 } rowGap={ 16 } columnGap={ 16 }> | ||
{ duotones.map( ( duotone: Duotone ) => { | ||
return ( | ||
<Grid | ||
key={ duotone.slug } | ||
className="edit-site-style-book__duotone-example" | ||
columns={ 2 } | ||
rowGap={ 8 } | ||
columnGap={ 8 } | ||
> | ||
<View> | ||
<img | ||
alt={ `Duotone example: ${ duotone.slug }` } | ||
src="https://s.w.org/images/core/5.3/MtBlanc1.jpg" | ||
style={ { | ||
filter: `url(#wp-duotone-${ duotone.slug })`, | ||
} } | ||
/> | ||
</View> | ||
{ duotone.colors.map( ( color ) => { | ||
return ( | ||
<View | ||
key={ color } | ||
className="edit-site-style-book__color-example" | ||
style={ { backgroundColor: color } } | ||
/> | ||
); | ||
} ) } | ||
</Grid> | ||
); | ||
} ) } | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default DuotoneExamples; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.