Skip to content

Commit 2e4e079

Browse files
authored
Global Styles Sidebar: tweak preview box (#39978)
* Global Styles Sidebar: tweak preview box size * Tweak color watch size to `32` px * Increase margin between swatches from 8 to 16px
1 parent e102e3f commit 2e4e079

File tree

1 file changed

+15
-7
lines changed
  • packages/edit-site/src/components/global-styles

1 file changed

+15
-7
lines changed

packages/edit-site/src/components/global-styles/preview.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ const secondFrame = {
4141
},
4242
};
4343

44-
const normalizedWidth = 250;
44+
const normalizedWidth = 248;
45+
const normalizedHeight = 152;
46+
47+
const normalizedColorSwatchSize = 32;
4548

4649
const StylesPreview = ( { label, isFocused } ) => {
4750
const [ fontWeight ] = useStyle( 'typography.fontWeight' );
@@ -81,7 +84,7 @@ const StylesPreview = ( { label, isFocused } ) => {
8184
className="edit-site-global-styles-preview__iframe"
8285
head={ <EditorStyles styles={ styles } /> }
8386
style={ {
84-
height: 150 * ratio,
87+
height: normalizedHeight * ratio,
8588
visibility: ! width ? 'hidden' : 'visible',
8689
} }
8790
onMouseEnter={ () => setIsHovered( true ) }
@@ -91,7 +94,7 @@ const StylesPreview = ( { label, isFocused } ) => {
9194
{ containerResizeListener }
9295
<motion.div
9396
style={ {
94-
height: 150 * ratio,
97+
height: normalizedHeight * ratio,
9598
width: '100%',
9699
background: gradientValue ?? backgroundColor,
97100
cursor: 'pointer',
@@ -128,15 +131,20 @@ const StylesPreview = ( { label, isFocused } ) => {
128131
>
129132
Aa
130133
</div>
131-
<VStack spacing={ 2 * ratio }>
134+
<VStack spacing={ 4 * ratio }>
132135
{ highlightedColors.map( ( { slug, color } ) => (
133136
<div
134137
key={ slug }
135138
style={ {
136-
height: 30 * ratio,
137-
width: 30 * ratio,
139+
height:
140+
normalizedColorSwatchSize * ratio,
141+
width:
142+
normalizedColorSwatchSize * ratio,
138143
background: color,
139-
borderRadius: 15 * ratio,
144+
borderRadius:
145+
( normalizedColorSwatchSize *
146+
ratio ) /
147+
2,
140148
} }
141149
/>
142150
) ) }

0 commit comments

Comments
 (0)