Web: Components: Refactor file input border radius

This commit is contained in:
Aleksandr Lushkin 2023-07-10 16:43:47 +02:00
parent d2346a8d4a
commit 7badc8740c
3 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import Base from "../themes/base"; import Base from "../themes/base";
import { getCorrectBorderRadius } from "../utils/rtlUtils";
const paddingRightStyle = (props) => const paddingRightStyle = (props) =>
props.theme.fileInput.paddingRight[props.size]; props.theme.fileInput.paddingRight[props.size];
@ -81,11 +82,16 @@ const StyledFileInput = styled.div`
props.theme.input.borderColor}; props.theme.input.borderColor};
cursor: ${(props) => (props.isDisabled ? "default" : "pointer")}; cursor: ${(props) => (props.isDisabled ? "default" : "pointer")};
border-radius: ${({ theme }) =>
getCorrectBorderRadius(
theme.fileInput.icon.borderRadius,
theme.interfaceDirection
)};
${(props) => ${(props) =>
props.theme.interfaceDirection === "rtl" props.theme.interfaceDirection === "rtl"
? css` ? css`
left: 0; left: 0;
border-radius: ${props.theme.fileInput.icon.borderRadiusRtl};
& svg { & svg {
transform: scaleX(-1); transform: scaleX(-1);
@ -93,7 +99,6 @@ const StyledFileInput = styled.div`
` `
: css` : css`
right: 0; right: 0;
border-radius: ${props.theme.fileInput.icon.borderRadiusLtr};
`} `}
} }

View File

@ -698,8 +698,7 @@ const Base = {
background: white, background: white,
border: "1px solid", border: "1px solid",
borderRadiusLtr: "0 3px 3px 0", borderRadius: "0 3px 3px 0",
borderRadiusRtl: "3px 0 0 3px",
width: { width: {
base: "30px", base: "30px",

View File

@ -693,8 +693,7 @@ const Dark = {
background: "#292929", background: "#292929",
border: "1px solid", border: "1px solid",
borderRadiusLtr: "0 3px 3px 0", borderRadius: "0 3px 3px 0",
borderRadiusRtl: "3px 0 0 3px",
width: { width: {
base: "30px", base: "30px",