Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
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
20 changes: 12 additions & 8 deletions src/dataDisplay/Accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import styled from 'styled-components';

import FixedIcon from '../FixedIcon';

type StyledAccordionProps = AccordionMUIProps & {
type AccordionProps = AccordionMUIProps & {
compact?: boolean;
};

type StyledAccordionProps = AccordionMUIProps & {
$compact?: AccordionProps['compact'];
};

const StyledAccordion = styled(AccordionMUI)<StyledAccordionProps>`
&.MuiAccordion-root {
border-radius: ${({ compact }) => (compact ? '8px' : '0')};
border: ${({ compact, theme }) =>
compact ? '2px solid ' + theme.colors.separator : 'none'};
border-radius: ${({ $compact }) => ($compact ? '8px' : '0')};
border: ${({ $compact, theme }) =>
$compact ? '2px solid ' + theme.colors.separator : 'none'};
border-bottom: 2px solid ${({ theme }) => theme.colors.separator};
margin-bottom: ${({ compact }) => (compact ? '16px' : '0')};
margin-bottom: ${({ $compact }) => ($compact ? '16px' : '0')};
overflow: hidden;

&:before {
Expand All @@ -31,7 +35,7 @@ const StyledAccordion = styled(AccordionMUI)<StyledAccordionProps>`
}

&.Mui-expanded {
margin: ${({ compact }) => (compact ? '0 0 16px 0' : '0')};
margin: ${({ $compact }) => ($compact ? '0 0 16px 0' : '0')};
}

.MuiAccordionDetails-root {
Expand Down Expand Up @@ -68,9 +72,9 @@ export const Accordion = ({
compact,
children,
...props
}: StyledAccordionProps): ReactElement => {
}: AccordionProps): ReactElement => {
return (
<StyledAccordion square elevation={0} compact={compact} {...props}>
<StyledAccordion square elevation={0} $compact={compact} {...props}>
{children}
</StyledAccordion>
);
Expand Down
29 changes: 16 additions & 13 deletions src/inputs/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,20 @@ const customStyles: {
},
};

const StyledButton = styled(ButtonMUI)<{ localProps: LocalProps }>`
const StyledButton = styled(ButtonMUI)<{ $localProps: LocalProps }>`
&& {
height: ${({ theme, localProps }) =>
theme.buttons.size[localProps.size].height};
height: ${({ theme, $localProps }) =>
theme.buttons.size[$localProps.size].height};
&.MuiButton-root {
min-width: ${({ theme, localProps: { size } }) =>
min-width: ${({ theme, $localProps: { size } }) =>
theme.buttons.size[size].minWidth};
padding: ${({ theme, localProps: { size } }) =>
padding: ${({ theme, $localProps: { size } }) =>
theme.buttons.size[size].padding};
font-family: ${theme.fonts.fontFamily};
font-size: ${({ theme, localProps }) =>
theme.text.size[localProps.textSize ?? 'xl'].fontSize};
line-height: ${({ theme, localProps }) =>
theme.text.size[localProps.textSize ?? 'xl'].lineHeight};
font-size: ${({ theme, $localProps }) =>
theme.text.size[$localProps.textSize ?? 'xl'].fontSize};
line-height: ${({ theme, $localProps }) =>
theme.text.size[$localProps.textSize ?? 'xl'].lineHeight};
text-transform: none;
border-radius: 8px;
letter-spacing: 0;
Expand All @@ -244,9 +244,12 @@ const StyledButton = styled(ButtonMUI)<{ localProps: LocalProps }>`
opacity: ${({ theme }) => theme.colors.disabled.opacity};
}

${({ localProps }) => {
if (localProps.color !== undefined && localProps.variant !== undefined) {
return customStyles[localProps.color][localProps.variant];
${({ $localProps }) => {
if (
$localProps.color !== undefined &&
$localProps.variant !== undefined
) {
return customStyles[$localProps.color][$localProps.variant];
}
}}
}
Expand All @@ -267,7 +270,7 @@ export const Button = ({
<StyledButton
className={`${color} ${variant}`}
{...buttonMuiProps}
localProps={{ color, variant, size, textSize }}>
$localProps={{ color, variant, size, textSize }}>
{iconType && <StyledIcon size={iconSize} type={iconType} />}
{children}
</StyledButton>
Expand Down