Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Enhance style props types
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Aug 27, 2021
1 parent 6e2b448 commit 6106312
Show file tree
Hide file tree
Showing 17 changed files with 2,388 additions and 544 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"rollup-plugin-ignore": "1.0.9",
"rollup-plugin-proxy-directories": "1.2.0",
"rollup-plugin-terser": "7.0.2",
"typescript": "3.9.2"
"typescript": "4.4.2"
},
"workspaces": {
"packages": [
Expand Down
1 change: 1 addition & 0 deletions packages/bumbag-native-picker/src/Picker/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const useProps = createHook<PickerProps>(
onChange={onChange}
value={value}
overrides={overrides}
type="radio"
{...menuOptionGroupProps}
>
{options.map((option, index) => (
Expand Down
4 changes: 2 additions & 2 deletions packages/bumbag-native-toast/src/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export type LocalToastProps = {
textWrapperProps?: Partial<BoxProps>;
textProps?: Partial<RNTextInputProps>;
};
export type ToastProps = BoxProps & RNViewProps & LocalToastProps;
export type ToastProps = Omit<BoxProps, 'height'> & RNViewProps & LocalToastProps;

const useProps = createHook<ToastProps>(
(props) => {
const { textWrapperProps, textProps: textInputProps = {}, title } = props;
const boxProps = Box.useProps(props);
const boxProps = Box.useProps({ ...props, height: undefined });

//////////////////////////////////////////

Expand Down
2 changes: 2 additions & 0 deletions packages/bumbag-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"@testing-library/react-hooks": "1.1.0",
"@testing-library/react-native": "^7.1.0",
"bumbag": "^2.5.0",
"react-native": "0.65.1",
"react-native-svg": "12.1.0",
"react-test-renderer": "16.8.6"
},
"author": "Jake Moxey",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {
});

it('should render correctly with CSS props', () => {
const { container } = render(<ActionButtons position="absolute" top="0" />);
const { container } = render(<ActionButtons position="absolute" top="0px" />);
expect(container.firstChild).toMatchSnapshot();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/Block/__tests__/Block.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<Block position="absolute" top="0">
<Block position="absolute" top="0px">
Hello world
</Block>
);
Expand Down
10 changes: 0 additions & 10 deletions packages/bumbag/src/Box/__tests__/Box.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,6 @@ describe('props', () => {
expect(container.firstChild).toMatchSnapshot();
});

it('should render correctly with a spacing CSS prop', () => {
const { container } = render(<Box margin="xl" />);
expect(container.firstChild).toMatchSnapshot();
});

it('should render correctly with negative spacing CSS props', () => {
const { container } = render(<Box margin="-xl" />);
expect(container.firstChild).toMatchSnapshot();
});

it('should render correctly with a font CSS prop', () => {
const { container } = render(<Box font="default" />);
expect(container.firstChild).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/Flex/__tests__/Flex.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<Flex position="absolute" top="0">
<Flex position="absolute" top="0px">
Hello world
</Flex>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/bumbag/src/Group/__stories__/Group.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default { title: 'Group' };

export const _default = () => (
<Group>
<Box backgroundColor="primary" color="white" padding="0.5rem 1rem">
<Box backgroundColor="primary" color="white" padding="major-2">
Hello
</Box>
<Button>Send</Button>
Expand All @@ -15,7 +15,7 @@ export const _default = () => (

export const verticalGroups = () => (
<Group orientation="vertical">
<Box backgroundColor="primary" color="white" padding="0.5rem 1rem">
<Box backgroundColor="primary" color="white" padding="major-2">
Hello
</Box>
<Button>Send</Button>
Expand All @@ -25,7 +25,7 @@ export const verticalGroups = () => (

export const responsiveBreakpoint = () => (
<Group verticalBelow="widescreen">
<Box backgroundColor="primary" color="white" padding="0.5rem 1rem">
<Box backgroundColor="primary" color="white" padding="major-2">
Hello
</Box>
<Button>Send</Button>
Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/Group/__tests__/Group.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<Group position="absolute" top="0">
<Group position="absolute" top="0px">
<Button>Hello</Button>
<Box>World</Box>
</Group>
Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/Inline/__tests__/Inline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<Inline position="absolute" top="0">
<Inline position="absolute" top="0px">
Hello world
</Inline>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/InlineBlock/__tests__/InlineBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<InlineBlock position="absolute" top="0">
<InlineBlock position="absolute" top="0px">
Hello world
</InlineBlock>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('props', () => {

it('should render correctly with CSS props', () => {
const { container } = render(
<InlineFlex position="absolute" top="0">
<InlineFlex position="absolute" top="0px">
Hello world
</InlineFlex>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/bumbag/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ const useProps = createHook<InputProps>(
</>
)}
{before && (
<Box display="inline-flex" position="absolute" zIndex="3" height="100%">
<Box display="inline-flex" position="absolute" zIndex={3} height="100%">
{before}
</Box>
)}
{after && (
<Box display="inline-flex" position="absolute" right="0" zIndex="3" height="100%">
<Box display="inline-flex" position="absolute" right="0px" zIndex={3} height="100%">
{after}
</Box>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/bumbag/src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type LocalRadioProps = {
/** Automatically focus on the radio */
autoFocus?: boolean;
checked?: boolean;
radioProps?: React.InputHTMLAttributes<any>;
radioProps?: Partial<BoxProps> & React.InputHTMLAttributes<any>;
/** Is the radio checked by default? */
defaultChecked?: boolean;
/** Disables the radio */
Expand Down
Loading

0 comments on commit 6106312

Please sign in to comment.