Skip to content

Commit

Permalink
chore: remove unnecessary casting
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Dec 17, 2024
1 parent 4540290 commit c46858d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ export function App() {
const isMobile = useMediaQuery(Media.upToMedium(false))
const customTheme = useMemo(() => {
if (ACTIVE_CUSTOM_THEME === CustomTheme.HALLOWEEN && darkMode && isHalloweenEnabled) {
return 'darkHalloween' as CowSwapTheme
return 'darkHalloween'
}
if (ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && isChristmasEnabled) {
return darkMode ? ('darkChristmas' as CowSwapTheme) : ('lightChristmas' as CowSwapTheme)
return darkMode ? 'darkChristmas' : 'lightChristmas'
}
return undefined
}, [darkMode, isHalloweenEnabled, isChristmasEnabled])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>`
const backgroundColor = theme.darkMode ? '#0E0F2D' : '#65D9FF'
let backgroundImage
if (customTheme === ('darkHalloween' as CowSwapTheme)) {
if (customTheme === 'darkHalloween') {
backgroundImage = `url(${IMAGE_BACKGROUND_DARK_HALLOWEEN})`
} else if (
customTheme === ('darkChristmas' as CowSwapTheme) ||
customTheme === ('lightChristmas' as CowSwapTheme)
) {
} else if (customTheme === 'darkChristmas' || customTheme === 'lightChristmas') {
backgroundImage = theme.darkMode
? `url(${IMAGE_BACKGROUND_DARK_CHRISTMAS})`
: `url(${IMAGE_BACKGROUND_LIGHT_CHRISTMAS})`
Expand All @@ -72,13 +69,13 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>`
background-size: auto;
${({ customTheme }) =>
customTheme === ('darkHalloween' as CowSwapTheme) &&
customTheme === 'darkHalloween' &&
`
background-image: url(${IMAGE_BACKGROUND_DARK_HALLOWEEN_MEDIUM});
`}
${({ customTheme, theme }) =>
(customTheme === ('darkChristmas' as CowSwapTheme) || customTheme === ('lightChristmas' as CowSwapTheme)) &&
(customTheme === 'darkChristmas' || customTheme === 'lightChristmas') &&
`
background-image: url(${theme.darkMode ? IMAGE_BACKGROUND_DARK_CHRISTMAS_MEDIUM : IMAGE_BACKGROUND_LIGHT_CHRISTMAS_MEDIUM});
`}
Expand All @@ -89,13 +86,13 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>`
min-height: ${({ theme }) => (theme.isInjectedWidgetMode ? 'initial' : 'calc(100vh - 100px)')};
${({ customTheme }) =>
customTheme === ('darkHalloween' as CowSwapTheme) &&
customTheme === 'darkHalloween' &&
`
background-image: url(${IMAGE_BACKGROUND_DARK_HALLOWEEN_SMALL});
`}
${({ customTheme, theme }) =>
(customTheme === ('darkChristmas' as CowSwapTheme) || customTheme === ('lightChristmas' as CowSwapTheme)) &&
(customTheme === 'darkChristmas' || customTheme === 'lightChristmas') &&
`
background-image: url(${theme.darkMode ? IMAGE_BACKGROUND_DARK_CHRISTMAS_SMALL : IMAGE_BACKGROUND_LIGHT_CHRISTMAS_SMALL});
`}
Expand Down

0 comments on commit c46858d

Please sign in to comment.