Skip to content

Commit

Permalink
refactor(herobody): use known types
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Sep 20, 2023
1 parent 9546655 commit 76c0b19
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/layouts/components/Homepage/HeroBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ export interface HeroBodyFormFields {
background: string
}

const getIconButtonProps = (color: "black" | "grey" | "white") => {
const getIconButtonProps = (color: SectionBackgroundColor) => {
return {
"aria-label": `${color} background`,
border: "1px solid",
borderColor: "border.input.default",
bg: color === "grey" ? "base.divider.strong" : color,
bg: color === "gray" ? "base.divider.strong" : color,
colorScheme: color,
size: "sm",
isRound: true,
_focus: {
boxShadow: "0 0 0 2px var(--chakra-colors-border-action-default)",
},
...(color === "grey" && {
...(color === "gray" && {
_hover: {
bg: "base.divider.strong",
},
Expand Down Expand Up @@ -181,7 +181,7 @@ const HeroSideSectionLayout = ({
alignment = "left",
}: HeroSideSectionProps) => {
const { onChange } = useEditableContext()
const onClick = (value: string) =>
const onClick = (value: SectionBackgroundColor) =>
onChange({
target: {
id: "section-0-hero-backgroundColor",
Expand Down Expand Up @@ -268,7 +268,7 @@ const HeroSideSectionLayout = ({
</Tooltip>
<Tooltip label="translucent gray" hasArrow>
<IconButton
{...getIconButtonProps("grey")}
{...getIconButtonProps("gray")}
onClick={() => onClick("gray")}
icon={<BxGrayTranslucent />}
/>
Expand Down

0 comments on commit 76c0b19

Please sign in to comment.