Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol-designer): add public sans to protocol-designer #15932

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions protocol-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"homepage": "https://github.com/Opentrons/opentrons",
"license": "Apache-2.0",
"dependencies": {
"@fontsource/public-sans": "5.0.3",
"@hot-loader/react-dom": "17.0.1",
"@vitejs/plugin-react": "^4.2.1",
"@vituum/vite-plugin-postcss": "1.1.0",
Expand Down
14 changes: 14 additions & 0 deletions protocol-designer/src/atoms/GlobalStyle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createGlobalStyle } from 'styled-components'
import '@fontsource/public-sans'
import '@fontsource/public-sans/600.css'
import '@fontsource/public-sans/700.css'

export const GlobalStyle = createGlobalStyle<{ enableRedesign?: boolean }>`
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: ${props =>
props.enableRedesign ?? false ? 'Public Sans' : 'Open Sans'}, sans-serif;
}
`
25 changes: 18 additions & 7 deletions protocol-designer/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { Provider } from 'react-redux'
import { Provider, useSelector } from 'react-redux'
import { I18nextProvider } from 'react-i18next'

import { configureStore } from './configureStore'
import { initialize } from './initialize'
import { initializeMixpanel } from './analytics/mixpanel'
import { getEnableRedesign } from './feature-flags/selectors'
import { i18n } from './localization'
import { App } from './App'
import { GlobalStyle } from './atoms/GlobalStyle'

// initialize Redux
const store = configureStore()
Expand All @@ -20,13 +22,22 @@ const container = document.getElementById('root')
if (container == null) throw new Error('Failed to find the root element')
const root = ReactDOM.createRoot(container)

const render = (Component: any): void => {
root.render(
<Provider store={store}>
const RootComponent = (): JSX.Element => {
const enableRedesign = useSelector(getEnableRedesign)
console.log('enableRedesign', enableRedesign)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('enableRedesign', enableRedesign)


return (
<>
<GlobalStyle enableRedesign={enableRedesign} />
<I18nextProvider i18n={i18n}>
<Component />
<App />
</I18nextProvider>
</Provider>
</>
)
}
render(App)

root.render(
<Provider store={store}>
<RootComponent />
</Provider>
)
Loading