Skip to content

Commit

Permalink
Add link variant box
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-mp committed Dec 12, 2024
1 parent c41b16e commit fe9f24f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Box } from "@prismicio/editor-ui";
import { Flex } from "theme-ui";

import { Col, Flex as FlexGrid } from "@/legacy/components/Flex";
Expand All @@ -6,7 +7,7 @@ import { createFieldNameFromKey } from "@/legacy/lib/forms";
import { DefaultFields } from "@/legacy/lib/forms/defaults";
import { CheckBox } from "@/legacy/lib/forms/fields";

import { DisplayTextCheckbox, RepeatableCheckbox } from "./components";
import { DisplayTextCheckbox, RepeatableCheckbox, Variant } from "./components";

const FormFields = {
...DefaultFields,
Expand Down Expand Up @@ -64,12 +65,16 @@ const Form = (props) => {
</Flex>
</Col>
</FlexGrid>
<RepeatableCheckbox
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
checked={repeat}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
setFieldValue={setFieldValue}
/>
<Box height={8} />
<Box flexDirection="column" gap={16}>
<RepeatableCheckbox
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
checked={repeat}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
setFieldValue={setFieldValue}
/>
<Variant />
</Box>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Icon, Text, Tooltip } from "@prismicio/editor-ui";
import { Box, Icon, Switch, Text, Tooltip } from "@prismicio/editor-ui";
import { Checkbox, Flex, Label } from "theme-ui";

import { Col } from "@/legacy/components/Flex";
Expand Down Expand Up @@ -57,13 +57,7 @@ export function RepeatableCheckbox(props: CommonCheckboxProps) {

return (
<Box flexDirection="column">
<Label
htmlFor="repeat"
variant="label.primary"
sx={{
mt: 2,
}}
>
<Label htmlFor="repeat" variant="label.primary">
Repeatable
</Label>
<Label variant="label.border" sx={{ display: "flex" }}>
Expand Down Expand Up @@ -95,3 +89,41 @@ export function RepeatableCheckbox(props: CommonCheckboxProps) {
</Box>
);
}

export function Variant() {
return (
<Box overflow="hidden" flexDirection="column" border borderRadius={6}>
<Box
border={{ bottom: true }}
padding={12}
flexDirection="column"
gap={8}
>
<Text variant="h4" color="grey12">
Variants
</Text>
<Text color="grey11">
Add variants like "Primary" and "Secondary" to allow editors to choose
the link's style by selecting one of them.
</Text>
<Box gap={8}>
<Switch />
<Text color="grey11">Disabled</Text>
</Box>
</Box>
<Box backgroundColor="white" flexDirection="column" padding={12}>
<Text variant="normal" color="grey11">
Need additional properties similar to "Variants"?{" "}
<a
href="https://prismic.io/"
target="_blank"
rel="noopener noreferrer"
style={{ color: "inherit", textDecoration: "underline" }}
>
Please, provide your feedback here.
</a>
</Text>
</Box>
</Box>
);
}

0 comments on commit fe9f24f

Please sign in to comment.