Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move styled components and get rid of unnecessary ones
  • Loading branch information
sarayourfriend committed Aug 9, 2021
commit 1496e0af1ef3ca8d988882f81da078c0b799aa22
26 changes: 4 additions & 22 deletions packages/components/src/ui/color-picker/input-with-slider.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
/**
* External dependencies
*/
import styled from '@emotion/styled';

/**
* Internal dependencies
*/
import RangeControl from '../../range-control';
import NumberControl from '../../number-control';
import { HStack } from '../../h-stack';
import { Text } from '../../text';
import { Spacer } from '../../spacer';
import { space } from '../utils/space';
import { StyledField } from '../../base-control/styles/base-control-styles';

const StyledRangeControl = styled( RangeControl )`
flex: 1;

${ StyledField } {
margin-bottom: 0;
}
`;

const Wrapper = styled( HStack )`
margin-bottom: ${ space( 2 ) };
`;
import { RangeControl } from './styles';

interface InputWithSliderProps {
min: number;
Expand All @@ -44,7 +26,7 @@ export const InputWithSlider = ( {
value,
}: InputWithSliderProps ) => {
return (
<Wrapper>
<Spacer as={ HStack }>
<NumberControl
__unstableInputWidth="5em"
min={ min }
Expand All @@ -60,7 +42,7 @@ export const InputWithSlider = ( {
}
hideHTMLArrows
/>
<StyledRangeControl
<RangeControl
label={ label }
hideLabelFromVision
min={ min }
Expand All @@ -69,6 +51,6 @@ export const InputWithSlider = ( {
onChange={ onChange }
withInputField={ false }
/>
</Wrapper>
</Spacer>
);
};
9 changes: 9 additions & 0 deletions packages/components/src/ui/color-picker/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import styled from '@emotion/styled';
* Internal dependencies
*/
import InnerSelectControl from '../../select-control';
import InnerRangeControl from '../../range-control';
import { StyledField } from '../../base-control/styles/base-control-styles';
import { space } from '../utils/space';

export const SelectControl = styled( InnerSelectControl )`
width: 5em;
`;

export const RangeControl = styled( InnerRangeControl )`
flex: 1;

${ StyledField } {
margin-bottom: 0;
}
`;

export const ColorfulWrapper = styled.div`
width: 216px;

Expand Down