Skip to content

Commit

Permalink
fix: supprime le style global sur body
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Nov 14, 2024
1 parent c88b84a commit 11cd3a6
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 84 deletions.
2 changes: 1 addition & 1 deletion front/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{/if}}
</head>
<body>
<div id="root" aria-live></div>
<div id="root" aria-live style="height: 100%;"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="./src/index.jsx"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/Write/write.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
display: flex;
flex-direction: row;
gap: 1em;
max-height: calc(100vh - 80px);
max-height: calc(100vh - 91px);
}

:global {
Expand Down
6 changes: 0 additions & 6 deletions front/src/components/articles.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
@use '../styles/defaults' as *;
@use '../styles/variables' as *;

:global {
body {
overflow-y: scroll;
}
}

.articleCounter {
font-size: 1.1rem;
font-weight: 600;
Expand Down
6 changes: 0 additions & 6 deletions front/src/components/corpus/corpus.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
@use '../../styles/defaults' as *;
@use '../../styles/variables' as *;

:global {
body {
overflow-y: scroll;
}
}

.section {
@extend .wrapped-center;
padding: 1rem;
Expand Down
130 changes: 65 additions & 65 deletions front/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const workspacePathsRx = /^\/workspaces\/(?<id>[a-z0-9]+)\/(?:articles|books)$/
try {
const { user, token } = await getUserProfile({ applicationConfig, sessionToken })
const pathname = location.pathname
const workspacePathRxResult = pathname.match(workspacePathsRx)
const workspacePathRxResult = pathname.match(workspacePathsRx)
let activeWorkspaceId
if (workspacePathRxResult) {
activeWorkspaceId = workspacePathRxResult.groups.id
Expand Down Expand Up @@ -98,70 +98,70 @@ root.render(
<Provider store={store}>
<Suspense fallback={<Loading/>}>
<Router>
<TrackPageViews/>
<Header/>
<App>
<Switch>
<Route path="/register" exact>
<Register/>
</Route>
{/* Articles index */}
<PrivateRoute path={['/articles', '/', '/workspaces/:workspaceId/articles']} exact>
<Articles/>
</PrivateRoute>
{/* Books index */}
<PrivateRoute path={['/books', '/workspaces/:workspaceId/books']} exact>
<Corpus/>
</PrivateRoute>
{/* Workspaces index */}
<PrivateRoute path={['/workspaces']} exact>
<Workspaces/>
</PrivateRoute>
<PrivateRoute path="/credentials" exact>
<UserInfos />
<Credentials/>
</PrivateRoute>
{/* Annotate a Book */}
<Route path={[`/books/:bookId/preview`]} exact>
<ArticlePreview/>
</Route>
{/* Annotate an article or its version */}
<Route path={[`/article/:id/version/:version/preview`, `/article/:id/preview`]} exact>
<ArticlePreview/>
</Route>
{/* Write and Compare */}
<PrivateRoute path={[`/article/:id/compare/:compareTo`, `/article/:id/version/:version/compare/:compareTo`]} exact>
<Write/>
</PrivateRoute>
{/* Write with a given version */}
<PrivateRoute path={`/article/:id/version/:version`} exact>
<Write/>
</PrivateRoute>
{/* Write and/or Preview */}
<PrivateRoute path={[`/article/:id/preview`, `/article/:id`]} exact>
<Write/>
</PrivateRoute>
{/* Collaborative editing */}
<PrivateRoute path={[`/article/:articleId/session/:sessionId`]} exact>
<CollaborativeEditor/>
</PrivateRoute>
<Route exact path="/privacy">
<Privacy/>
</Route>
<Route exact path="/ux">
<Story/>
</Route>
<Route exact path="/error">
<Error/>
</Route>
<Route path="*">
<NotFound/>
</Route>
</Switch>
</App>

<Footer/>
</Router>
<App>
<TrackPageViews/>
<Header/>
<Switch>
<Route path="/register" exact>
<Register/>
</Route>
{/* Articles index */}
<PrivateRoute path={['/articles', '/', '/workspaces/:workspaceId/articles']} exact>
<Articles/>
</PrivateRoute>
{/* Books index */}
<PrivateRoute path={['/books', '/workspaces/:workspaceId/books']} exact>
<Corpus/>
</PrivateRoute>
{/* Workspaces index */}
<PrivateRoute path={['/workspaces']} exact>
<Workspaces/>
</PrivateRoute>
<PrivateRoute path="/credentials" exact>
<UserInfos/>
<Credentials/>
</PrivateRoute>
{/* Annotate a Book */}
<Route path={[`/books/:bookId/preview`]} exact>
<ArticlePreview/>
</Route>
{/* Annotate an article or its version */}
<Route path={[`/article/:id/version/:version/preview`, `/article/:id/preview`]} exact>
<ArticlePreview/>
</Route>
{/* Write and Compare */}
<PrivateRoute
path={[`/article/:id/compare/:compareTo`, `/article/:id/version/:version/compare/:compareTo`]} exact>
<Write/>
</PrivateRoute>
{/* Write with a given version */}
<PrivateRoute path={`/article/:id/version/:version`} exact>
<Write/>
</PrivateRoute>
{/* Write and/or Preview */}
<PrivateRoute path={[`/article/:id/preview`, `/article/:id`]} exact>
<Write/>
</PrivateRoute>
{/* Collaborative editing */}
<PrivateRoute path={[`/article/:articleId/session/:sessionId`]} exact>
<CollaborativeEditor/>
</PrivateRoute>
<Route exact path="/privacy">
<Privacy/>
</Route>
<Route exact path="/ux">
<Story/>
</Route>
<Route exact path="/error">
<Error/>
</Route>
<Route path="*">
<NotFound/>
</Route>
</Switch>
<Footer/>
</App>
</Router>
</Suspense>
</Provider>
</GeistProvider>
Expand Down
24 changes: 19 additions & 5 deletions front/src/layouts/App.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { Loading } from '@geist-ui/core'
import clsx from 'clsx'
import React, { Suspense } from 'react'
import { useSelector } from 'react-redux'
import { Route, Switch } from 'react-router-dom'

import styles from './app.module.scss'


export default function StyloApp ({ children }) {
const hasBooted = useSelector(state => state.hasBooted)

return (
<main>
<Suspense fallback={<Loading />}>
{hasBooted ? (children) : <Loading />}
</Suspense>
</main>
<Suspense fallback={<Loading/>}>
{hasBooted ?
<Switch>
<Route path="/article/*">
<main className={clsx(styles.app, styles.viewportMaxHeight)}>
{children}
</main>
</Route>
<Route path="*">
<main className={styles.app}>
{children}
</main>
</Route>
</Switch> : <Loading/>}
</Suspense>
)
}
12 changes: 12 additions & 0 deletions front/src/layouts/app.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.app {
overflow-y: scroll;
height: 100%;
}

.viewportMaxHeight {
overflow-y: auto;
}

.content {
min-height: 100vh;
}

0 comments on commit 11cd3a6

Please sign in to comment.