Skip to content

Commit

Permalink
fea: support dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MounirDhahri committed Jan 21, 2025
1 parent 1fa8966 commit 157b9ca
Show file tree
Hide file tree
Showing 133 changed files with 193 additions and 200 deletions.
6 changes: 3 additions & 3 deletions src/elements/BackButton/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface BackButtonProps {
}

export const BackButton: React.FC<BackButtonProps> = ({
color = "onBackgroundHigh",
color = "black100",
hitSlop = DEFAULT_HIT_SLOP,
onPress,
showX = false,
Expand All @@ -40,7 +40,7 @@ export const BackButton: React.FC<BackButtonProps> = ({
}

export const BackButtonWithBackground: React.FC<BackButtonProps> = ({
color = "onBackgroundHigh",
color = "black100",
hitSlop = DEFAULT_HIT_SLOP,
onPress,
showX = false,
Expand All @@ -49,7 +49,7 @@ export const BackButtonWithBackground: React.FC<BackButtonProps> = ({
return (
<TouchableOpacity onPress={onPress} hitSlop={hitSlop}>
<Flex
backgroundColor="background"
backgroundColor="white100"
width={40}
height={40}
borderRadius={20}
Expand Down
12 changes: 6 additions & 6 deletions src/elements/Button/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export const useColorsForVariantAndState = (): Record<
},
outline: {
disabled: {
bg: color("background"),
border: color("onBackgroundLow"),
text: color("onBackgroundLow"),
bg: color("black100"),
border: color("black30"),
text: color("black30"),
},
pressed: { bg: color("blue100"), border: color("blue100"), text: color("white100") },
active: {
bg: color("background"),
border: color("onBackgroundMedium"),
text: color("onBackgroundHigh"),
bg: color("black100"),
border: color("black60"),
text: color("white100"),
},
},
outlineGray: {
Expand Down
9 changes: 2 additions & 7 deletions src/elements/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,16 @@ export const Chip: FC<ChipProps> = ({ image, title, subtitle, onPress }) => {
}

return (
<Touchable
onPress={onPress}
onPressIn={handleOnPressIn}
onPressOut={handleOnPressOut}
noFeedback
>
<Touchable onPress={onPress} onPressIn={handleOnPressIn} onPressOut={handleOnPressOut}>
<Flex flexDirection="row" minWidth={200} height={70} overflow="hidden" borderRadius={5}>
{!!image && <Image src={image} width={70} height={70} />}

<View
state={animatedState}
style={{
flex: 1,
padding: space(1),
justifyContent: "center",
backgroundColor: color("black5"),
}}
>
{!!subtitle && (
Expand Down
12 changes: 2 additions & 10 deletions src/elements/Input/InputTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,12 @@ export const InputTitle: React.FC<{
<Text variant="md" style={{ fontSize: 13, marginBottom: 2, textTransform: "uppercase" }}>
{title}
{!!required && (
<Text
variant="md"
style={{ fontSize: 13, textTransform: "none" }}
color="onBackgroundMedium"
>
<Text variant="md" style={{ fontSize: 13, textTransform: "none" }} color="black60">
Required
</Text>
)}
{!!optional && (
<Text
variant="md"
style={{ fontSize: 13, textTransform: "none" }}
color="onBackgroundMedium"
>
<Text variant="md" style={{ fontSize: 13, textTransform: "none" }} color="black60">
{" "}
Optional
</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/elements/MenuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const MenuItem = ({
pr="15px"
>
<Flex flexDirection="row" mr={2}>
<Text variant="md" color="onBackgroundHigh">
<Text variant="md" color="black100">
{title}
</Text>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Screen/BottomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const BottomView: React.FC<BottomViewProps> = ({ children, darkMode }) =>
}}
pointerEvents="none"
/>
<Flex px={SCREEN_HORIZONTAL_PADDING} pt={1} pb={4} backgroundColor="background">
<Flex px={SCREEN_HORIZONTAL_PADDING} pt={1} pb={4} backgroundColor="white100">
{children}
</Flex>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Screen/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Header: React.FC<HeaderProps> = ({
flexDirection="row"
px={2}
zIndex={ZINDEX.header}
backgroundColor="background"
backgroundColor="white100"
alignItems="center"
>
<Flex flex={1}>
Expand Down Expand Up @@ -125,7 +125,7 @@ const Left: React.FC<{
<>
{leftElements || (
<Touchable onPress={onBack} underlayColor="transparent" hitSlop={DEFAULT_HIT_SLOP}>
<ArrowLeftIcon fill="onBackgroundHigh" />
<ArrowLeftIcon fill="black100" />
</Touchable>
)}
</>
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Screen/ScreenBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ScreenBase: React.FC<ScreenBaseProps> = ({
<ScreenScrollContextProvider>
<Flex
flex={1}
backgroundColor="background"
backgroundColor="white100"
mt={safeArea ? (insets.top as FlexProps["mt"]) : 0}
{...flexProps}
>
Expand All @@ -40,7 +40,7 @@ const SafeAreaCover: React.FC<{ safeArea: boolean }> = ({ safeArea }) => {
right={0}
top={safeArea ? -insets.top : 0}
height={insets.top}
backgroundColor="background"
backgroundColor="white100"
/>
)
}
2 changes: 1 addition & 1 deletion src/elements/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const SearchInput = ({
return (
<Flex flexDirection="row" justifyContent="center">
<Input
icon={<MagnifyingGlassIcon width={18} height={18} fill="onBackgroundHigh" />}
icon={<MagnifyingGlassIcon width={18} height={18} fill="black100" />}
autoCorrect={false}
enableClearButton={enableCancelButton}
returnKeyType="search"
Expand Down
12 changes: 6 additions & 6 deletions src/elements/Spacer/Spacer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const SpacerRow = (props: { x: NoUndefined<SpacerProps["x"]> }) => {
return (
<Box>
<Box flexDirection="row">
<Box width={20} height={20} backgroundColor="onBackground" />
<Box width={20} height={20} backgroundColor="black100" />
<Spacer {...props} />
<Box width={20} height={20} backgroundColor="onBackground" />
<Box width={20} height={20} backgroundColor="black100" />
</Box>
<Text color="onBackground">
<Text color="black100">
{typeof size === "string" ? `${size}` : `${size} ${bullet} ${space(size as any)}px`}
</Text>
</Box>
Expand Down Expand Up @@ -52,11 +52,11 @@ const SpacerCol = (props: { y: SpacerProps["y"] }) => {
return (
<Box>
<Box flexDirection="column">
<Box width={20} height={20} backgroundColor="black" />
<Box width={20} height={20} backgroundColor="black100" />
<Spacer {...props} />
<Box width={20} height={20} backgroundColor="black" />
<Box width={20} height={20} backgroundColor="black100" />
</Box>
<Text color="black">
<Text color="black100">
{typeof size === "string" ? `${size}` : `${size} ${bullet} ${space(size as any)}px`}
</Text>
</Box>
Expand Down
8 changes: 6 additions & 2 deletions src/elements/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ export interface SwitchProps extends CustomSwitchProps {

export const Switch = ({
value,
thumbColorActive = Platform.OS === "ios" ? "white100" : "blue100",
thumbColorInactive = Platform.OS === "ios" ? "white100" : "black10",
// Regardless of the color scheme, the thumb and track colors are always white
// @ts-expect-error
thumbColorActive = Platform.OS === "ios" ? "white" : "blue100",
// Regardless of the color scheme, the thumb and track colors are always white
// @ts-expect-error
thumbColorInactive = Platform.OS === "ios" ? "white" : "black10",
trackColorActive = Platform.OS === "ios" ? "blue100" : "blue10",
trackColorInactive = "black30",
disabled,
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Tabs/TabsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const TabsContainer: React.FC<TabsContainerProps> = ({
shadowOpacity: 0,
shadowRadius: 0,
elevation: 0,
backgroundColor: color("background"),
backgroundColor: color("white100"),
}}
initialTabName={initialTabName}
containerStyle={{
Expand Down Expand Up @@ -85,11 +85,11 @@ export const TabsContainer: React.FC<TabsContainerProps> = ({
)
}}
contentContainerStyle={{}}
activeColor={color("onBackground")}
inactiveColor={color("onBackgroundMedium")}
activeColor={color("black100")}
inactiveColor={color("black60")}
labelStyle={{ marginHorizontal: 0 }} // removing the horizonal margin from the lib
indicatorStyle={{
backgroundColor: color("onBackground"),
backgroundColor: color("black100"),
height: 1,
// on android this line breaks the active indicator and it is not visible
...(isIOS && { bottom: -1 }),
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Text = forwardRef(
{
variant = "sm",
italic = false,
color = "onBackgroundHigh",
color = "black100",
caps = false,
weight = "regular",
underline = false,
Expand Down
2 changes: 1 addition & 1 deletion src/storybook/decorators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const useDarkModeSwitcher: DecoratorFunction<ReactNode> = (story) => {
<ScreenDimensionsProvider>
<SafeAreaProvider>
<Theme theme={theme}>
<Flex flex={1} backgroundColor="background">
<Flex flex={1} backgroundColor="white100">
<Flex flexDirection="row" justifyContent="space-around">
<Text color="orange">
Dark mode: {mode} {mode === "system" && "(" + systemMode + ")"}
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AddCircleFillIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AddCircleFillIcon = ({ fill, ...restProps }: IconProps) => {
export const AddCircleFillIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AddCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AddCircleIcon = ({ fill, ...restProps }: IconProps) => {
export const AddCircleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AddIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AddIcon = ({ fill, ...restProps }: IconProps) => {
export const AddIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AlertCircleFillIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AlertCircleFillIcon = ({ fill, ...restProps }: IconProps) => {
export const AlertCircleFillIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AlertIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AlertIcon = ({ fill, ...restProps }: IconProps) => {
export const AlertIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/AppleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const AppleIcon = ({ fill, ...restProps }: IconProps) => {
export const AppleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowDownCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowDownCircleIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowDownCircleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowDownIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowDownIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowLeftCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowLeftCircleIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowLeftCircleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowRightCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowRightCircleIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowRightCircleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowRightIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowRightIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowRightIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowUpCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowUpCircleIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowUpCircleIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowUpIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowUpIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowUpIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 18 18">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArrowUpRightIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArrowUpRightIcon = ({ fill, ...restProps }: IconProps) => {
export const ArrowUpRightIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()

return (
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArtsyLogoWhiteIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { G, Icon, IconProps, Path } from "./Icon"

export const ArtsyLogoWhiteIcon = ({ fill, ...restProps }: IconProps) => {
export const ArtsyLogoWhiteIcon = ({ fill = "black100", ...restProps }: IconProps) => {
return (
<Icon {...restProps} viewBox="0 0 94 32">
<G fill="none" fillRule="evenodd">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArtsyMarkBlackIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { G, Icon, IconProps, Path } from "./Icon"
import { useColor } from "../utils/hooks"

export const ArtsyMarkBlackIcon = ({ fill, ...restProps }: IconProps) => {
export const ArtsyMarkBlackIcon = ({ fill = "black100", ...restProps }: IconProps) => {
const color = useColor()
return (
<Icon {...restProps} viewBox="0 0 32 32">
Expand Down
2 changes: 1 addition & 1 deletion src/svgs/ArtsyMarkWhiteIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { G, Icon, IconProps, Path } from "./Icon"

export const ArtsyMarkWhiteIcon = ({ fill, ...restProps }: IconProps) => {
export const ArtsyMarkWhiteIcon = ({ fill = "black100", ...restProps }: IconProps) => {
return (
<Icon {...restProps} viewBox="0 0 32 32">
<G fill="none" fillRule="evenodd">
Expand Down
Loading

0 comments on commit 157b9ca

Please sign in to comment.