fixed Code Smells from PR 1494 (#1536)

Co-authored-by: Anton Zorin <zorii4@Antons-MacBook-Pro.local>
Co-authored-by: Oleg Shur <workshur@gmail.com>
This commit is contained in:
Zorii4 2022-02-02 16:04:27 +03:00 committed by GitHub
parent f248ad1c39
commit 0b5f9283d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,24 +5,8 @@ interface TitleProps {
isOrdered?: boolean; isOrdered?: boolean;
} }
export const Title = styled.span<TitleProps>( const orderableMixin = css(
({ isOrderable, isOrdered, theme: { table } }) => css` ({ theme: { table } }) => `
font-family: Inter, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 16px;
letter-spacing: 0em;
text-align: left;
justify-content: start;
display: flex;
align-items: center;
background: ${table.th.backgroundColor.normal};
cursor: default;
color: ${table.th.color.normal};
${isOrderable &&
css`
cursor: pointer; cursor: pointer;
padding-right: 18px; padding-right: 18px;
@ -58,11 +42,11 @@ export const Title = styled.span<TitleProps>(
border-top-color: ${table.th.color.hover}; border-top-color: ${table.th.color.hover};
} }
} }
`} `
);
${isOrderable && const orderedMixin = css(
isOrdered && ({ theme: { table } }) => `
css`
color: ${table.th.color.active}; color: ${table.th.color.active};
&::before { &::before {
border-bottom-color: ${table.th.color.active}; border-bottom-color: ${table.th.color.active};
@ -70,7 +54,28 @@ export const Title = styled.span<TitleProps>(
&::after { &::after {
border-top-color: ${table.th.color.active}; border-top-color: ${table.th.color.active};
} }
`} `
);
export const Title = styled.span<TitleProps>(
({ isOrderable, isOrdered, theme: { table } }) => css`
font-family: Inter, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 16px;
letter-spacing: 0em;
text-align: left;
justify-content: start;
display: flex;
align-items: center;
background: ${table.th.backgroundColor.normal};
cursor: default;
color: ${table.th.color.normal};
${isOrderable && orderableMixin}
${isOrderable && isOrdered && orderedMixin}
` `
); );