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:
parent
f248ad1c39
commit
0b5f9283d6
1 changed files with 54 additions and 49 deletions
|
@ -5,6 +5,58 @@ interface TitleProps {
|
||||||
isOrdered?: boolean;
|
isOrdered?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const orderableMixin = css(
|
||||||
|
({ theme: { table } }) => `
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
padding-right: 18px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::before,
|
||||||
|
&::after {
|
||||||
|
border: 4px solid transparent;
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
height: 0;
|
||||||
|
right: 5px;
|
||||||
|
top: 50%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
border-bottom-color: ${table.th.color.normal};
|
||||||
|
margin-top: -9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border-top-color: ${table.th.color.normal};
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: ${table.th.color.hover};
|
||||||
|
&::before {
|
||||||
|
border-bottom-color: ${table.th.color.hover};
|
||||||
|
}
|
||||||
|
&::after {
|
||||||
|
border-top-color: ${table.th.color.hover};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
const orderedMixin = css(
|
||||||
|
({ theme: { table } }) => `
|
||||||
|
color: ${table.th.color.active};
|
||||||
|
&::before {
|
||||||
|
border-bottom-color: ${table.th.color.active};
|
||||||
|
}
|
||||||
|
&::after {
|
||||||
|
border-top-color: ${table.th.color.active};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
export const Title = styled.span<TitleProps>(
|
export const Title = styled.span<TitleProps>(
|
||||||
({ isOrderable, isOrdered, theme: { table } }) => css`
|
({ isOrderable, isOrdered, theme: { table } }) => css`
|
||||||
font-family: Inter, sans-serif;
|
font-family: Inter, sans-serif;
|
||||||
|
@ -21,56 +73,9 @@ export const Title = styled.span<TitleProps>(
|
||||||
cursor: default;
|
cursor: default;
|
||||||
color: ${table.th.color.normal};
|
color: ${table.th.color.normal};
|
||||||
|
|
||||||
${isOrderable &&
|
${isOrderable && orderableMixin}
|
||||||
css`
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
padding-right: 18px;
|
${isOrderable && isOrdered && orderedMixin}
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::before,
|
|
||||||
&::after {
|
|
||||||
border: 4px solid transparent;
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
height: 0;
|
|
||||||
right: 5px;
|
|
||||||
top: 50%;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
border-bottom-color: ${table.th.color.normal};
|
|
||||||
margin-top: -9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
border-top-color: ${table.th.color.normal};
|
|
||||||
margin-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: ${table.th.color.hover};
|
|
||||||
&::before {
|
|
||||||
border-bottom-color: ${table.th.color.hover};
|
|
||||||
}
|
|
||||||
&::after {
|
|
||||||
border-top-color: ${table.th.color.hover};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
|
|
||||||
${isOrderable &&
|
|
||||||
isOrdered &&
|
|
||||||
css`
|
|
||||||
color: ${table.th.color.active};
|
|
||||||
&::before {
|
|
||||||
border-bottom-color: ${table.th.color.active};
|
|
||||||
}
|
|
||||||
&::after {
|
|
||||||
border-top-color: ${table.th.color.active};
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue