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: remove config() utility function, use values directly #31646

Merged
merged 3 commits into from
May 12, 2021
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
18 changes: 8 additions & 10 deletions packages/components/src/spinner/styles/spinner-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { keyframes } from '@emotion/core';
/**
* Internal dependencies
*/
import { COLORS, config } from '../../utils';
import { COLORS, CONFIG } from '../../utils';

const spinAnimation = keyframes`
from {
Expand All @@ -19,15 +19,13 @@ const spinAnimation = keyframes`
}
`;

const topLeft = `calc( ( ${ config( 'spinnerSize' ) } - ${ config(
'spinnerSize'
) } * ( 2 / 3 ) ) / 2 )`;
const topLeft = `calc( ( ${ CONFIG.spinnerSize } - ${ CONFIG.spinnerSize } * ( 2 / 3 ) ) / 2 )`;

export const StyledSpinner = styled.span`
display: inline-block;
background-color: ${ COLORS.gray[ 600 ] };
width: ${ config( 'spinnerSize' ) };
height: ${ config( 'spinnerSize' ) };
width: ${ CONFIG.spinnerSize };
height: ${ CONFIG.spinnerSize };
opacity: 0.7;
margin: 5px 11px 0;
border-radius: 100%;
Expand All @@ -39,11 +37,11 @@ export const StyledSpinner = styled.span`
background-color: ${ COLORS.white };
top: ${ topLeft };
left: ${ topLeft };
width: calc( ${ config( 'spinnerSize' ) } / 4.5 );
height: calc( ${ config( 'spinnerSize' ) } / 4.5 );
width: calc( ${ CONFIG.spinnerSize } / 4.5 );
height: calc( ${ CONFIG.spinnerSize } / 4.5 );
border-radius: 100%;
transform-origin: calc( ${ config( 'spinnerSize' ) } / 3 )
calc( ${ config( 'spinnerSize' ) } / 3 );
transform-origin: calc( ${ CONFIG.spinnerSize } / 3 )
calc( ${ CONFIG.spinnerSize } / 3 );
animation: ${ spinAnimation } 1s infinite linear;
}
`;
10 changes: 0 additions & 10 deletions packages/components/src/utils/config.js

This file was deleted.

8 changes: 4 additions & 4 deletions packages/components/src/utils/input/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import { css } from '@emotion/core';
* Internal dependencies
*/
import { reduceMotion } from '../reduce-motion';
import { config } from '../config';
import { COLORS } from '../colors-values';
import { CONFIG } from '../';

export const inputStyleNeutral = css`
box-shadow: 0 0 0 transparent;
transition: box-shadow 0.1s linear;
border-radius: ${ config( 'radiusBlockUi' ) };
border: ${ config( 'borderWidth' ) } solid ${ COLORS.ui.border };
border-radius: ${ CONFIG.radiusBlockUi };
border: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border } };
${ reduceMotion( 'transition' ) }
`;

export const inputStyleFocus = css`
border-color: var( --wp-admin-theme-color );
box-shadow: 0 0 0
calc( ${ config( 'borderWidthFocus' ) } - ${ config( 'borderWidth' ) } )
calc( ${ CONFIG.borderWidthFocus } - ${ CONFIG.borderWidth } )
var( --wp-admin-theme-color );

// Windows High Contrast mode will show this outline, but not the box-shadow.
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/utils/style-mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ export { rtl } from './rtl';
export { space } from './space';
export { font } from './font';
export { breakpoint } from './breakpoint';
export { config } from './config';
export { default as CONFIG } from './config-values';
export { COLORS } from './colors-values';