From 0cbe0c1d2bd7a937cc822c70da0af851ca1d1389 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 14 Jul 2020 16:10:01 +0300 Subject: [PATCH] Show palette with both hardcoded and theme colors --- .../media-placeholder/styles.native.scss | 4 +-- .../block-library/src/cover/edit.native.js | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/components/media-placeholder/styles.native.scss b/packages/block-editor/src/components/media-placeholder/styles.native.scss index bf3bf2a598ad28..5ce646208a391d 100644 --- a/packages/block-editor/src/components/media-placeholder/styles.native.scss +++ b/packages/block-editor/src/components/media-placeholder/styles.native.scss @@ -21,8 +21,8 @@ .emptyStateTitle { text-align: center; - margin-top: 8; - margin-bottom: 10; + margin-top: 4; + margin-bottom: 16; font-size: 14; color: #2e4453; } diff --git a/packages/block-library/src/cover/edit.native.js b/packages/block-library/src/cover/edit.native.js index df34ea9c275a70..2fa057f84d9889 100644 --- a/packages/block-library/src/cover/edit.native.js +++ b/packages/block-library/src/cover/edit.native.js @@ -93,12 +93,23 @@ const Cover = ( { } = attributes; const CONTAINER_HEIGHT = minHeight || COVER_DEFAULT_HEIGHT; - const COVER_DEFAULT_PALETTE = { - colors: settings.colors.filter( ( c ) => - [ 'black', 'white', 'vivid-cyan-blue', 'pale-pink' ].includes( - c.slug - ) - ), + const DEFAULT_COLORS = [ + { + name: __( 'Black' ), + slug: 'black', + color: '#000000', + }, + { + name: __( 'White' ), + slug: 'white', + color: '#ffffff', + }, + ]; + + const THEME_COLORS_COUNT = 2; + const themeColors = settings.colors.slice( 0, THEME_COLORS_COUNT ); + const coverDefaultPalette = { + colors: [ ...DEFAULT_COLORS, ...themeColors ], }; const { gradientValue } = __experimentalUseGradient(); @@ -348,7 +359,7 @@ const Cover = ( { customStyles={ styles } setColor={ setColor } onCustomPress={ noop } - defaultSettings={ COVER_DEFAULT_PALETTE } + defaultSettings={ coverDefaultPalette } shouldShowCustomIndicatorOption={ false } shouldShowCustomLabel={ false } />