Skip to content
Open
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
24 changes: 17 additions & 7 deletions packages/design-system/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import { Loader } from '@strapi/icons';
import { styled, keyframes } from 'styled-components';
import { styled, keyframes, css } from 'styled-components';

import { Flex, FlexComponent, FlexProps } from '../../primitives/Flex';
import { Typography } from '../../primitives/Typography';
Expand Down Expand Up @@ -116,22 +116,32 @@ const ButtonWrapper = styled<FlexComponent<'button'>>(Flex)<ButtonWrapperProps>`
const sizeValue = theme.sizes.button[$size];

if (typeof sizeValue === 'string') {
return `height: ${sizeValue};`;
return css`
height: ${sizeValue};
`;
}

const styles: string[] = [];
Object.entries(sizeValue).forEach(([breakpoint, breakpointValue]) => {
const styles = Object.entries(sizeValue).map(([breakpoint, breakpointValue]) => {
if (breakpointValue) {
if (breakpoint === 'initial') {
styles.push(`height: ${breakpointValue};`);
return css`
height: ${breakpointValue};
`;
} else if (breakpoint in theme.breakpoints) {
const breakpointQuery = theme.breakpoints[breakpoint as keyof typeof theme.breakpoints];
styles.push(`${breakpointQuery} { height: ${breakpointValue}; }`);
return css`
${breakpointQuery} {
height: ${breakpointValue};
}
`;
}
}
return null;
});

return styles.join('\n');
return css`
${styles}
`;
}}
text-decoration: none;
${getVariantStyle}
Expand Down