|
| 1 | +import { Button } from '@wordpress/components' |
| 2 | + |
| 3 | +export const DEFAULT_COLOR_SCHEME_COLORS = { |
| 4 | + backgroundColor: { desktop: 'var(--stk-container-background-color, #fff)' }, |
| 5 | + headingColor: { desktop: '' }, |
| 6 | + textColor: { desktop: '' }, |
| 7 | + linkColor: { desktop: '' }, |
| 8 | + accentColor: { desktop: 'var(--stk-accent-color, #008de4)' }, |
| 9 | + buttonColor: { desktop: 'var(--stk-button-background-color, #008de4)' }, |
| 10 | + buttonTextColor: { desktop: 'var(--stk-button-text-color, #fff)' }, |
| 11 | + buttonOutlineColor: { desktop: 'var(--stk-button-background-color, #008de4)' }, |
| 12 | +} |
| 13 | + |
| 14 | +export const DEFAULT_BACKGROUND_COLOR_SCHEME_COLORS = { |
| 15 | + ...DEFAULT_COLOR_SCHEME_COLORS, |
| 16 | + backgroundColor: { desktop: 'var(--stk-block-background-color, #fff)' }, |
| 17 | +} |
| 18 | + |
| 19 | +const NOOP = () => {} |
| 20 | + |
| 21 | +const ColorSchemePreview = ( { colors, onClick = NOOP } ) => { |
| 22 | + const TagName = onClick === NOOP ? 'div' : Button |
| 23 | + const additionalProps = onClick === NOOP ? {} : { onClick } |
| 24 | + return ( |
| 25 | + <TagName |
| 26 | + className="stk-global-color-scheme__preview__background" |
| 27 | + style={ { backgroundColor: colors?.backgroundColor } } |
| 28 | + { ...additionalProps } |
| 29 | + > |
| 30 | + <div className="stk-global-color-scheme__preview__typography"> |
| 31 | + <span style={ { color: colors?.headingColor } }>A</span> |
| 32 | + <span style={ { color: colors?.textColor } }>a</span> |
| 33 | + </div> |
| 34 | + <div> |
| 35 | + <div |
| 36 | + className="stk-global-color-scheme__preview__button" |
| 37 | + style={ { backgroundColor: colors?.buttonColor } } |
| 38 | + /> |
| 39 | + <div |
| 40 | + className="stk-global-color-scheme__preview__button" |
| 41 | + style={ { |
| 42 | + borderStyle: 'solid', |
| 43 | + borderWidth: '1px', |
| 44 | + borderColor: colors?.buttonOutlineColor, |
| 45 | + } } |
| 46 | + /> |
| 47 | + </div> |
| 48 | + </TagName> |
| 49 | + ) |
| 50 | +} |
| 51 | + |
| 52 | +export default ColorSchemePreview |
0 commit comments