-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try no using blocks for color tab examples
- Loading branch information
1 parent
40f168a
commit 729334e
Showing
7 changed files
with
248 additions
and
214 deletions.
There are no files selected for viewing
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; |
202 changes: 0 additions & 202 deletions
202
packages/edit-site/src/components/style-book/examples.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.