Skip to content

Commit

Permalink
chore(tx-builder): use the safe theme instead safe-react-components t…
Browse files Browse the repository at this point in the history
…heme
  • Loading branch information
clovisdasilvaneto committed Sep 25, 2024
1 parent 9b830de commit 95506c1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
2 changes: 1 addition & 1 deletion apps/tx-builder/src/assets/add-new-batch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 13 additions & 6 deletions apps/tx-builder/src/global.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createGlobalStyle } from 'styled-components'
import avertaFont from '@gnosis.pm/safe-react-components/dist/fonts/averta-normal.woff2'
import avertaBoldFont from '@gnosis.pm/safe-react-components/dist/fonts/averta-bold.woff2'
import DMSansFont from './assets/fonts/DMSansRegular.woff2'
import DMSansBoldFont from './assets/fonts/DMSans700.woff2'

const GlobalStyle = createGlobalStyle`
html {
Expand All @@ -17,12 +17,19 @@ const GlobalStyle = createGlobalStyle`
#root {
height: 100%;
}
@font-face {
font-family: 'DM Sans';
font-display: swap;
font-weight: 400;
src: url(${DMSansFont}) format('woff2');
}
@font-face {
font-family: 'Averta';
src: local('Averta'), local('Averta Bold'),
url(${avertaFont}) format('woff2'),
url(${avertaBoldFont}) format('woff');
font-family: 'DM Sans';
font-display: swap;
font-weight: bold;
src: url(${DMSansBoldFont}) format('woff2');
}
input:-webkit-autofill,
Expand Down
26 changes: 15 additions & 11 deletions apps/tx-builder/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import ReactDOM from 'react-dom'
import { ThemeProvider } from 'styled-components'
import { theme } from '@gnosis.pm/safe-react-components'
import { SafeProvider } from '@safe-global/safe-apps-react-sdk'
import { BrowserRouter } from 'react-router-dom'

Expand All @@ -9,19 +7,25 @@ import * as serviceWorker from './serviceWorker'
import GlobalStyles from './global'
import App from './App'
import StoreProvider from './store'
import SafeThemeProvider from './theme/SafeThemeProvider'
import { ThemeProvider } from 'styled-components'

ReactDOM.render(
<>
<GlobalStyles />
<ThemeProvider theme={theme}>
<SafeProvider>
<StoreProvider>
<BrowserRouter basename={process.env.PUBLIC_URL}>
<App />
</BrowserRouter>
</StoreProvider>
</SafeProvider>
</ThemeProvider>
<SafeThemeProvider mode="light">
{theme => (
<ThemeProvider theme={theme}>
<SafeProvider>
<StoreProvider>
<BrowserRouter basename={process.env.PUBLIC_URL}>
<App />
</BrowserRouter>
</StoreProvider>
</SafeProvider>
</ThemeProvider>
)}
</SafeThemeProvider>
</>,
document.getElementById('root'),
)
Expand Down
20 changes: 12 additions & 8 deletions apps/tx-builder/src/test-utils.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { ReactElement } from 'react'
import { ThemeProvider } from 'styled-components'
import { render, RenderResult } from '@testing-library/react'
import { theme } from '@gnosis.pm/safe-react-components'
import { SafeProvider } from '@safe-global/safe-apps-react-sdk'
import { BrowserRouter } from 'react-router-dom'
import StoreProvider from './store'
import SafeThemeProvider from './theme/SafeThemeProvider'

const renderWithProviders = (Components: ReactElement): RenderResult => {
return render(
<ThemeProvider theme={theme}>
<SafeProvider>
<StoreProvider>
<BrowserRouter>{Components}</BrowserRouter>
</StoreProvider>
</SafeProvider>
</ThemeProvider>,
<SafeThemeProvider mode="light">
{theme => (
<ThemeProvider theme={theme}>
<SafeProvider>
<StoreProvider>
<BrowserRouter>{Components}</BrowserRouter>
</StoreProvider>
</SafeProvider>
</ThemeProvider>
)}
</SafeThemeProvider>,
)
}

Expand Down

0 comments on commit 95506c1

Please sign in to comment.