* refactor: 🔧 del unnecessary children type Change-Id: I3dea5e07f5401bdbdd168eb959fe361c57784167 * feat: 💄 eslint Change-Id: Ie173adeca9e3112d8cdfc1f85964332105dcb424 * feat: 🔧 add css type Change-Id: I8850c4d09b152f4d9c4d98e6eebca58bd9eecd37 * fix: 💄 ci lint Change-Id: I69ff89c7a30e2bdcd26475ec83f3f5ec143121b6
80 lines
1.4 KiB
TypeScript
80 lines
1.4 KiB
TypeScript
import { transparentize } from "polished";
|
|
import * as React from "react";
|
|
import styled from "styled-components";
|
|
import breakpoint from "styled-components-breakpoint";
|
|
import Flex from "~/components/Flex";
|
|
import Text from "~/components/Text";
|
|
|
|
type Props = {
|
|
label: React.ReactNode;
|
|
description: React.ReactNode;
|
|
name: string;
|
|
visible?: boolean;
|
|
border?: boolean;
|
|
};
|
|
|
|
const Row = styled(Flex)<{ $border?: boolean }>`
|
|
display: block;
|
|
padding: 24px 0;
|
|
border-bottom: 1px solid
|
|
${(props) =>
|
|
props.$border === false
|
|
? "transparent"
|
|
: transparentize(0.5, props.theme.divider)};
|
|
|
|
${breakpoint("tablet")`
|
|
display: flex;
|
|
`};
|
|
|
|
&:last-child {
|
|
border-bottom: 0;
|
|
}
|
|
`;
|
|
|
|
const Column = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-basis: 100%;
|
|
flex: 1;
|
|
|
|
&:first-child {
|
|
min-width: 60%;
|
|
}
|
|
|
|
${breakpoint("tablet")`
|
|
p {
|
|
margin-bottom: 0;
|
|
}
|
|
`};
|
|
`;
|
|
|
|
const Label = styled(Text)`
|
|
margin-bottom: 4px;
|
|
`;
|
|
|
|
const SettingRow: React.FC<Props> = ({
|
|
visible,
|
|
description,
|
|
name,
|
|
label,
|
|
border,
|
|
children,
|
|
}) => {
|
|
if (visible === false) {
|
|
return null;
|
|
}
|
|
return (
|
|
<Row gap={32} $border={border}>
|
|
<Column>
|
|
<Label as="h3">
|
|
<label htmlFor={name}>{label}</label>
|
|
</Label>
|
|
<Text type="secondary">{description}</Text>
|
|
</Column>
|
|
<Column>{children}</Column>
|
|
</Row>
|
|
);
|
|
};
|
|
|
|
export default SettingRow;
|