Skip to content

Commit

Permalink
refactor: updater default color usage DEV-94
Browse files Browse the repository at this point in the history
  • Loading branch information
giubatt committed Jun 10, 2021
1 parent c95e90d commit 1b0d9e5
Show file tree
Hide file tree
Showing 27 changed files with 106 additions and 108 deletions.
16 changes: 8 additions & 8 deletions src/components/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default forwardRef(function Autocomplete<T>(

const styles: Record<string, ThemeUICSSObject> = {
active: {
borderColor: "secondary.0",
borderColor: "secondary",
boxShadow: (t) =>
`0px 0px 0px 4px ${get(t, "colors.secondary.alpha.90")}`,
backgroundColor: "#FFF",
Expand Down Expand Up @@ -161,7 +161,7 @@ export default forwardRef(function Autocomplete<T>(
<label
{...getLabelProps()}
sx={{
color: "text.0",
color: "text",
variant: "text.body1",
}}
>
Expand Down Expand Up @@ -235,7 +235,7 @@ export default forwardRef(function Autocomplete<T>(
transition: "all 0s",
variant: "text.body2",
"& > span": {
color: "text.0",
color: "text",
fontWeight: 600,
},
}}
Expand Down Expand Up @@ -309,11 +309,11 @@ export default forwardRef(function Autocomplete<T>(
loading: {},
success: {
backgroundColor: "success.alpha.95",
borderColor: "success.0",
borderColor: "success",
},
error: {
backgroundColor: "primary.alpha.95",
borderColor: "primary.0",
borderColor: "primary",
},
}[state],
"&:hover": {
Expand Down Expand Up @@ -346,7 +346,7 @@ export default forwardRef(function Autocomplete<T>(
sx={{
backgroundColor: "transparent",
border: "none",
color: "text.0",
color: "text",
flexGrow: 1,
opacity: !selectedOption || isOpen ? 1 : 0,
outline: 0,
Expand Down Expand Up @@ -436,13 +436,13 @@ export default forwardRef(function Autocomplete<T>(
success: {
px: 3,
pb: 2,
color: "success.0",
color: "success",
variant: "text.body1",
},
error: {
px: 3,
pb: 2,
color: "primary.0",
color: "primary",
variant: "text.body1",
},
}[state],
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Breadcrumbs = ({ children }: BreadcrumbsProps) => {
key={`child-${index}`}
sx={
index === allItems.length - 1
? { color: "text.0", variant: "text.heading3" }
? { color: "text", variant: "text.heading3" }
: {}
}
>
Expand Down
14 changes: 7 additions & 7 deletions src/components/EditableField/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ const EditableFieldSelect = ({
const stateStyles: Record<string, ThemeUICSSObject> = {
active: {
backgroundColor: "#fff",
color: "text.0",
color: "text",
boxShadow: (theme) =>
`0px 0px 0px 4px ${get(theme, "colors.secondary.alpha.95")}`,
borderColor: "secondary.0",
borderColor: "secondary",
fontWeight: "semibold",
},
}
Expand Down Expand Up @@ -220,16 +220,16 @@ const EditableFieldSelect = ({
borderRadius: 2,
border: "2px solid",
borderColor: "transparent",
color: "text.0",
color: "text",

...{
default: {},
loading: stateStyles.active,
success: {
borderColor: "success.0",
borderColor: "success",
},
error: {
borderColor: "primary.0",
borderColor: "primary",
},
}[state],

Expand All @@ -256,10 +256,10 @@ const EditableFieldSelect = ({
default: {},
loading: {},
success: {
color: "success.0",
color: "success",
},
error: {
color: "primary.0",
color: "primary",
},
}[state],
}}
Expand Down
18 changes: 9 additions & 9 deletions src/components/EditableField/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const EditableText = forwardRef<

const styles: Record<string, ThemeUICSSObject> = {
active: {
borderColor: "secondary.0",
borderColor: "secondary",
boxShadow: (theme) =>
`0px 0px 0px 4px ${get(theme, "colors.secondary.alpha.90")}`,
backgroundColor: "#FFF",
Expand Down Expand Up @@ -210,10 +210,10 @@ const EditableText = forwardRef<
default: {},
loading: styles.active,
success: {
borderColor: "success.0",
borderColor: "success",
},
error: {
borderColor: "primary.0",
borderColor: "primary",
},
}[state],

Expand Down Expand Up @@ -243,7 +243,7 @@ const EditableText = forwardRef<
sx={{
backgroundColor: "transparent",
border: "none",
color: "text.0",
color: "text",
flexGrow: 1,
outline: 0,
p: 0,
Expand Down Expand Up @@ -274,7 +274,7 @@ const EditableText = forwardRef<
border: "none",
p: 0,
py: "2px", // the 2px border counts towards height, so we need 6px instead of 8px for the correct height
color: "text.0",
color: "text",
variant: "text.body1",
}}
/>
Expand All @@ -286,15 +286,15 @@ const EditableText = forwardRef<
<Icon
name="IconAlertCircle"
size={16}
sx={{ color: "primary.0" }}
sx={{ color: "primary" }}
/>
),
loading: "",
success: (
<Icon
name="IconCircleCheck"
size={16}
sx={{ color: "success.0" }}
sx={{ color: "success" }}
/>
),
}[state]
Expand All @@ -311,10 +311,10 @@ const EditableText = forwardRef<
default: {},
loading: {},
success: {
color: "success.0",
color: "success",
},
error: {
color: "primary.0",
color: "primary",
},
}[state],
}}
Expand Down
16 changes: 8 additions & 8 deletions src/components/EditableText/EditableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const EditableText = forwardRef<HTMLInputElement, EditableTextProps>(

const styles: Record<string, ThemeUICSSObject> = {
active: {
borderColor: "secondary.0",
borderColor: "secondary",
boxShadow: (theme) =>
`0px 0px 0px 4px ${get(theme, "colors.secondary.alpha.90")}`,
backgroundColor: "#FFF",
Expand Down Expand Up @@ -118,10 +118,10 @@ const EditableText = forwardRef<HTMLInputElement, EditableTextProps>(
default: {},
loading: {},
success: {
borderColor: "success.0",
borderColor: "success",
},
error: {
borderColor: "primary.0",
borderColor: "primary",
},
}[state],

Expand Down Expand Up @@ -168,7 +168,7 @@ const EditableText = forwardRef<HTMLInputElement, EditableTextProps>(
border: "none",
p: 0,
py: "2px", // the 2px border counts towards height, so we need 6px instead of 8px for the correct height
color: "text.0",
color: "text",
variant: "text.body1",
}}
/>
Expand All @@ -179,15 +179,15 @@ const EditableText = forwardRef<HTMLInputElement, EditableTextProps>(
<Icon
name="IconAlertCircle"
size={16}
sx={{ color: "primary.0" }}
sx={{ color: "primary" }}
/>
),
loading: <Spinner />,
success: (
<Icon
name="IconCircleCheck"
size={16}
sx={{ color: "success.0" }}
sx={{ color: "success" }}
/>
),
}[state]
Expand Down Expand Up @@ -231,10 +231,10 @@ const EditableText = forwardRef<HTMLInputElement, EditableTextProps>(
default: {},
loading: {},
success: {
color: "success.0",
color: "success",
},
error: {
color: "primary.0",
color: "primary",
},
}[state],
}}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Highlight/Highlight.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This component is designed to highlight text on search components, for instance,

##### backgroundColor

- The background color to the Highlight Component: default is highlight.0
- The background color to the Highlight Component: default is highlight

##### text

Expand All @@ -27,7 +27,7 @@ This component is designed to highlight text on search components, for instance,
#### Color Change

```jsx
<Highlight backgroundColor="primary.0" search="highlight" text="This is a simple text for highlighting purposes" />
<Highlight backgroundColor="primary" search="highlight" text="This is a simple text for highlighting purposes" />
```

#### Double Highlight
Expand Down
2 changes: 1 addition & 1 deletion src/components/Highlight/Highlight.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Example.args = {
export const ColorChange = Template.bind({})

ColorChange.args = {
backgroundColor: "primary.0",
backgroundColor: "primary",
search: "highlight",
text: "This is a simple text for highlighting purposes",
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Highlight/Highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface HighlightProps {
}

const Highlight = ({
backgroundColor = "highlight.0",
backgroundColor = "highlight",
search,
text,
}: HighlightProps) => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputProps>(
...{
default: {},
success: {
borderColor: "success.0",
borderColor: "success",
},
error: {
borderColor: "primary.0",
borderColor: "primary",
},
}[state],
"&:focus-within": {
borderColor: "secondary.0",
borderColor: "secondary",
boxShadow: (theme) =>
`0px 0px 0px 4px ${get(theme, "colors.secondary.alpha.90")}`,
backgroundColor: "#FFF",
Expand Down Expand Up @@ -198,7 +198,7 @@ const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputProps>(
sx={{
backgroundColor: "transparent",
border: "none",
color: "text.0",
color: "text",
flexGrow: 1,
outline: 0,
p: 0,
Expand Down Expand Up @@ -233,7 +233,7 @@ const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputProps>(
backgroundColor: "transparent",
border: "none",
p: 0,
color: "text.0",
color: "text",
variant: "text.body1",

// removes background color when input was filled with autofill in chromium
Expand Down Expand Up @@ -265,7 +265,7 @@ const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputProps>(
onClick={() => setPasswordVisible((value) => !value)}
sx={{
display: "flex",
color: passwordVisible ? "secondary.0" : "text.40",
color: passwordVisible ? "secondary" : "text.40",
cursor: "pointer",
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListSelect/ListSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ListSelect = ({
: "transparent",
variant: "text.body1",
fontWeight: isSelected ? "semibold" : "medium",
color: isSelected ? "secondary.0" : "text.0",
color: isSelected ? "secondary" : "text",
":focus": {
backgroundColor: isSelected
? "secondary.alpha.90"
Expand Down
Loading

0 comments on commit 1b0d9e5

Please sign in to comment.