-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove styled-components completely from thorin
- Loading branch information
1 parent
ba82748
commit b2f0211
Showing
71 changed files
with
824 additions
and
1,742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 22 additions & 31 deletions
53
components/src/components/atoms/BackdropSurface/BackdropSurface.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,27 @@ | ||
import type { TransitionState } from 'react-transition-state' | ||
import * as React from 'react' | ||
|
||
import styled, { css } from 'styled-components' | ||
import type { TransitionState } from 'react-transition-state' | ||
|
||
export const BackdropSurface = styled.div<{ | ||
$state: TransitionState | ||
$empty: boolean | ||
}>( | ||
({ theme, $state, $empty }) => css` | ||
width: 100vw; | ||
height: 100vh; | ||
position: fixed; | ||
overflow: hidden; | ||
z-index: 999; | ||
top: 0; | ||
left: 0; | ||
transition: ${theme.transitionDuration['300']} all | ||
${theme.transitionTimingFunction.popIn}; | ||
import { backdropSurface } from './styles.css' | ||
import { Box, BoxProps } from '../Box' | ||
|
||
${!$empty && $state === 'entered' | ||
? css` | ||
background-color: rgba(0, 0, 0, ${theme.opacity.overlayFallback}); | ||
type Props = { $state: TransitionState; $empty: boolean } & BoxProps | ||
|
||
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) { | ||
backdrop-filter: blur(16px); | ||
background-color: rgba(0, 0, 0, ${theme.opacity.overlay}); | ||
} | ||
` | ||
: css` | ||
background-color: rgba(0, 0, 0, 0); | ||
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) { | ||
backdrop-filter: blur(0px); | ||
} | ||
`} | ||
`, | ||
export const BackdropSurface = ({ $empty, $state, ...props }: Props) => ( | ||
<Box | ||
{...props} | ||
className={backdropSurface({ entered: !$empty && $state === 'entered' })} | ||
height="100vh" | ||
left="$0" | ||
overflow="hidden" | ||
position="fixed" | ||
top="$0" | ||
transitionDuration="$300" | ||
transitionProperty="all" | ||
transitionTimingFunction="$popIn" | ||
width="100vw" | ||
zIndex="999" | ||
/> | ||
) | ||
|
||
BackdropSurface.displayName = 'BackdropSurface' |
25 changes: 25 additions & 0 deletions
25
components/src/components/atoms/BackdropSurface/styles.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { recipe } from '@vanilla-extract/recipes' | ||
|
||
export const backdropSurface = recipe({ | ||
variants: { | ||
entered: { | ||
true: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
'@supports': { | ||
'(-webkit-backdrop-filter: none) or (backdrop-filter: none)': { | ||
backgroundColor: 'rgba(0, 0, 0, 0.1)', | ||
backdropFilter: 'blur(16px)', | ||
}, | ||
}, | ||
}, | ||
false: { | ||
backgroundColor: 'rgba(0, 0, 0, 0)', | ||
'@supports': { | ||
'(-webkit-backdrop-filter: none) or (backdrop-filter: none)': { | ||
backdropFilter: 'blur(0px)', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
import * as React from 'react' | ||
|
||
import { ThemeProvider } from 'styled-components' | ||
|
||
import { cleanup, render, screen } from '@/test' | ||
|
||
import { lightTheme } from '@/src/tokens' | ||
|
||
import { Button } from './Button' | ||
|
||
describe('<Button />', () => { | ||
afterEach(cleanup) | ||
|
||
it('renders', () => { | ||
render( | ||
<ThemeProvider theme={lightTheme}> | ||
<Button>Connect Wallet</Button> | ||
</ThemeProvider>, | ||
) | ||
render(<Button>Connect Wallet</Button>) | ||
expect(screen.getByText(/connect/i)).toBeInTheDocument() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.