Skip to content

Commit

Permalink
style: fix top bar at the top and refine paddings to align top bar wi…
Browse files Browse the repository at this point in the history
…th main content
  • Loading branch information
procaconsul committed May 20, 2024
1 parent 356dc41 commit 7f80bf6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/ExamRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Section } from '@radix-ui/themes'
import React, { FC } from 'react'
import { Outlet } from 'react-router-dom'

Expand All @@ -7,7 +8,9 @@ const ExamRoot: FC = () => {
return (
<>
<NavBar questionCount={3} />
<Outlet />
<Section pt="9">
<Outlet />
</Section>
</>
)
}
Expand Down
38 changes: 23 additions & 15 deletions src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Section, TabNav } from '@radix-ui/themes'
import { Container, Section, TabNav } from '@radix-ui/themes'
import React, { FC } from 'react'
import { useLocation } from 'react-router-dom'

Expand All @@ -10,21 +10,29 @@ const NavBar: FC<NavBarProps> = ({ questionCount }) => {
const { pathname } = useLocation()

return (
<Section p="4" pt="3" style={{ backgroundColor: 'var(--gray-a2)' }}>
<TabNav.Root size="2">
<TabNav.Link href="/frontcover" active={pathname === '/frontcover'}>
Frontcover
</TabNav.Link>
{[...Array(questionCount).keys()].map((i) => (
<TabNav.Link
href={`/questions/${i + 1}`}
key={i}
active={pathname === `/questions/${i + 1}`}
>
{`Question ${i + 1}`}
<Section
p="3"
position="fixed"
top="0"
width="100%"
style={{ backgroundColor: 'var(--gray-8)', zIndex: 1000 }}
>
<Container>
<TabNav.Root size="2">
<TabNav.Link href="/frontcover" active={pathname === '/frontcover'}>
Frontcover
</TabNav.Link>
))}
</TabNav.Root>
{[...Array(questionCount).keys()].map((i) => (
<TabNav.Link
href={`/questions/${i + 1}`}
key={i}
active={pathname === `/questions/${i + 1}`}
>
{`Question ${i + 1}`}
</TabNav.Link>
))}
</TabNav.Root>
</Container>
</Section>
)
}
Expand Down

0 comments on commit 7f80bf6

Please sign in to comment.