Skip to content

Commit

Permalink
refactor: color
Browse files Browse the repository at this point in the history
  • Loading branch information
airslice committed Oct 3, 2024
1 parent cbcb3f1 commit 06fdc6a
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions web/src/beta/lib/reearth-ui/components/Typography/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,18 @@ export const Typography: FC<TypographyProps> = ({
const memoizedStyle = useMemo(
() => ({
...otherProperties,
color:
color === "main"
? theme.content.main
: color === "weak"
? theme.content.weak
: color === "strong"
? theme.content.strong
: color === "weaker"
? theme.content.weaker
: color === "withBackground"
? theme.content.withBackground
: color
? color
: theme.content.main,
color: ["main", "weak", "strong", "weaker", "withBackground"].includes(
color ?? ""
)
? theme.content[color as keyof typeof theme.content]
: color
? color
: theme.content.main,
textOverflow: "ellipsis",
overflow: "hidden",
flexShrink: 0
}),
[otherProperties, theme.content, color]
[otherProperties, color, theme]
);

return ThemeTypography ? (
Expand Down

0 comments on commit 06fdc6a

Please sign in to comment.