Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: Clean up unused and duplicate COLORS values #43445

Merged
merged 18 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
### Internal

- `Tooltip`: Refactor tests to `@testing-library/react` ([#43061](https://github.com/WordPress/gutenberg/pull/43061)).
- Clean up unused and duplicate `COLORS` values ([#43445](https://github.com/WordPress/gutenberg/pull/43445)).
- Update `floating-ui` to the latest version ([#43206](https://github.com/WordPress/gutenberg/pull/43206)).
- `DateTimePicker`, `TimePicker`, `DatePicker`: Switch from `moment` to `date-fns` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)).
- `DatePicker`: Switch from `react-dates` to `use-lilius` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export const Row = styled.div`
const pointActive = ( { isActive } ) => {
const boxShadow = isActive ? `0 0 0 2px ${ COLORS.gray[ 900 ] }` : null;
const pointColor = isActive ? COLORS.gray[ 900 ] : COLORS.lightGray[ 800 ];
const pointColorHover = isActive
? COLORS.gray[ 900 ]
: COLORS.blue.medium.focus;
const pointColorHover = isActive ? COLORS.gray[ 900 ] : COLORS.ui.theme;

return css`
box-shadow: ${ boxShadow };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const CircleIndicatorWrapper = styled.div`
`;

export const CircleIndicator = styled.div`
background: ${ COLORS.admin.theme };
background: ${ COLORS.ui.theme };
border-radius: 50%;
border: ${ INNER_CIRCLE_SIZE }px solid ${ COLORS.admin.theme };
border: ${ INNER_CIRCLE_SIZE }px solid ${ COLORS.ui.theme };
bottom: 0;
box-sizing: border-box;
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const StyledHelp = styled.p`
margin-bottom: 0;
font-size: ${ font( 'helpText.fontSize' ) };
font-style: normal;
color: ${ COLORS.mediumGray.text };
color: ${ COLORS.gray[ 700 ] };

${ deprecatedMarginHelp }
`;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/base-field/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const BaseField = css`

&:focus,
&[data-focused='true'] {
border-color: ${ COLORS.admin.theme };
border-color: ${ COLORS.ui.theme };
box-shadow: ${ CONFIG.controlBoxShadowFocus };
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ exports[`base field should render correctly 1`] = `

.emotion-0:focus,
.emotion-0[data-focused='true'] {
border-color: var( --wp-admin-theme-color, #00669b);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #00669b);
border-color: var( --wp-admin-theme-color, #007cba);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
}

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const Container = styled.div`

export const Side = styled.div`
box-sizing: border-box;
background: ${ COLORS.blue.wordpress[ 700 ] };
background: ${ COLORS.ui.theme };
filter: brightness( 1 );
opacity: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ export const PointerIconPathOutline = styled( Path )`
`;

export const PointerIconPathFill = styled( Path )`
fill: ${ COLORS.blue.wordpress[ 700 ] };
fill: ${ COLORS.ui.theme };
`;
6 changes: 3 additions & 3 deletions packages/components/src/item-group/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const unstyledButton = css`
text-align: left;

&:hover {
color: ${ COLORS.admin.theme };
color: ${ COLORS.ui.theme };
}

&:focus {
background-color: transparent;
color: ${ COLORS.admin.theme };
border-color: ${ COLORS.admin.theme };
color: ${ COLORS.ui.theme };
border-color: ${ COLORS.ui.theme };
outline: 3px solid transparent;
}
`;
Expand Down
11 changes: 6 additions & 5 deletions packages/components/src/palette-edit/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const IndicatorStyled = styled( CircularOptionPicker.Option )`
export const NameInputControl = styled( InputControl )`
${ InputControlContainer } {
background: ${ COLORS.gray[ 100 ] };
border-radius: ${ CONFIG.controlBorderRadius }};
border-radius: ${ CONFIG.controlBorderRadius };
${ Input }${ Input }${ Input }${ Input } {
height: ${ space( 8 ) };
}
Expand Down Expand Up @@ -58,7 +58,7 @@ export const PaletteItem = styled( View )`
border-top-color: transparent;
}
&.is-selected {
border-color: ${ COLORS.blue.wordpress[ 700 ] };
border-color: ${ COLORS.ui.theme };
}
`;

Expand All @@ -69,7 +69,7 @@ export const NameContainer = styled.div`
white-space: nowrap;
overflow: hidden;
${ PaletteItem }:hover & {
color: var( --wp-admin-theme-color, ${ COLORS.blue.wordpress[ 700 ] } );
color: ${ COLORS.ui.theme };
}
`;

Expand All @@ -95,8 +95,9 @@ export const PaletteHStackHeader = styled( HStack )`
export const PaletteEditStyles = styled( View )`
&&& {
.components-button.has-icon {
min-width: 0;
padding: 0;
min-width: 0;
padding: 0;
}
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const wrapperMargin = ( { marks, __nextHasNoMarginBottom }: WrapperProps ) => {
};

export const Wrapper = styled.div< WrapperProps >`
color: ${ COLORS.blue.medium.focus };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line wasn't needed because color was being assigned again a few lines later (${ wrapperColor }; )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this down in the commit message so I don't forget, and then forgot to write it as a comment 😂 Sorry to make you sleuth!

display: block;
flex: 1;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/text/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const destructive = css`
`;

export const muted = css`
color: ${ COLORS.mediumGray.text };
color: ${ COLORS.gray[ 700 ] };
`;

export const highlighterText = css`
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/text/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe( 'Text', () => {
<Text variant="muted">Lorem ipsum.</Text>
);
expect( container.firstChild ).toHaveStyle( {
color: COLORS.mediumGray.text,
color: COLORS.gray[ 700 ],
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
}

.emotion-6:focus-within {
border-color: var( --wp-admin-theme-color-darker-10, #007cba);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #00669b);
border-color: var( --wp-admin-theme-color-darker-10, #006ba1);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
outline: none;
z-index: 1;
}
Expand Down Expand Up @@ -326,8 +326,8 @@ exports[`ToggleGroupControl should render correctly with text options 1`] = `
}

.emotion-6:focus-within {
border-color: var( --wp-admin-theme-color-darker-10, #007cba);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #00669b);
border-color: var( --wp-admin-theme-color-darker-10, #006ba1);
box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
outline: none;
z-index: 1;
}
Expand Down
Loading