-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[F] Table of Contents, Pagination fix, + GoogleSSOButton fix
- Has Table of Contents markup + js - Pagination and other components now use progress context - GoogleSSO button handleError method at a level that's accessible to parent func
- Loading branch information
Showing
21 changed files
with
847 additions
and
251 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
2 changes: 1 addition & 1 deletion
2
components/educator-schema/StoredAnswersWrapper/StoredAnswersWrapper.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
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,12 +1,74 @@ | ||
"use client"; | ||
|
||
import { FunctionComponent } from "react"; | ||
import { FunctionComponent, useState, useContext } from "react"; | ||
import { SlideoutMenu } from "@rubin-epo/epo-react-lib"; | ||
// import LanguageSelect from "./LanguageSelect"; | ||
import ProgressContext from "@/contexts/Progress"; | ||
import TableOfContents from "../TableOfContents"; | ||
import HeaderProgress from "@/components/page/HeaderProgress"; | ||
import useNavHider from "@/hooks/useNavHider"; | ||
import * as Styled from "./styles"; | ||
|
||
export const Header: FunctionComponent = () => { | ||
return <Styled.Header></Styled.Header>; | ||
const Header: FunctionComponent<HeaderProps> = () => { | ||
const { sections } = useContext(ProgressContext); | ||
const [prevScrollPos, setPrevScrollPos] = useState(0); | ||
const [visible, setVisible] = useState(true); | ||
const [mainMenuIsOpen, setMainMenuIsOpen] = useState(false); | ||
const [tocIsOpen, setTocIsOpen] = useState(false); | ||
|
||
useNavHider(prevScrollPos, setPrevScrollPos, visible, setVisible); | ||
|
||
return ( | ||
<Styled.Header | ||
className={`page-header ${ | ||
visible || mainMenuIsOpen || tocIsOpen ? "visible" : "invisible" | ||
}`} | ||
> | ||
<Styled.FullWidthCol> | ||
<Styled.TopRow> | ||
<Styled.MainMenuToggle | ||
aria-controls="mainMenu" | ||
aria-haspopup="menu" | ||
icon="hamburger" | ||
onClick={() => setMainMenuIsOpen(true)} | ||
> | ||
<div className="a-hidden">Toggle Main Menu</div> | ||
</Styled.MainMenuToggle> | ||
<Styled.TocToggle | ||
aria-controls="tableOfContents" | ||
aria-haspopup="menu" | ||
icon="doc" | ||
onClick={() => setTocIsOpen(true)} | ||
> | ||
<div>Table of Contents</div> | ||
</Styled.TocToggle> | ||
</Styled.TopRow> | ||
{!!sections.length && ( | ||
<Styled.BottomRow> | ||
<HeaderProgress /> | ||
</Styled.BottomRow> | ||
)} | ||
</Styled.FullWidthCol> | ||
<SlideoutMenu | ||
id="mainMenu" | ||
title="Main menu" | ||
callToAction="Settings and more" | ||
isOpen={mainMenuIsOpen} | ||
onCloseCallback={() => setMainMenuIsOpen(false)} | ||
> | ||
<div>MAIN MENU</div> | ||
{/* <LanguageSelect id="langSelect" /> */} | ||
</SlideoutMenu> | ||
<TableOfContents | ||
id="tableOfContents" | ||
title="Table of Contents" | ||
isOpen={tocIsOpen} | ||
onCloseCallback={() => setTocIsOpen(false)} | ||
/> | ||
</Styled.Header> | ||
); | ||
}; | ||
|
||
Header.displayName = "Page.Header"; | ||
Header.displayName = "Global.Header"; | ||
|
||
export default Header; |
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,13 +1,46 @@ | ||
import styled from "styled-components"; | ||
import { token } from "@rubin-epo/epo-react-lib/styles"; | ||
import { Button } from "@rubin-epo/epo-react-lib"; | ||
|
||
export const Header = styled.div` | ||
--header-height: 40px; | ||
export const Header = styled.header` | ||
display: flex; | ||
position: sticky; | ||
top: 0; | ||
transform: none; | ||
transition: transform 0.4s; | ||
background-color: var(--turquoise85, #12726d); | ||
height: var(--header-height); | ||
z-index: 1; | ||
@media screen and (min-width: ${token("BREAK_DESKTOP_SMALL")}) { | ||
--header-height: 72px; | ||
&.invisible { | ||
transform: translate3d(0, -100%, 0); | ||
} | ||
`; | ||
|
||
export const FullWidthCol = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
`; | ||
|
||
export const TopRow = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
flex-wrap: nowrap; | ||
width: 100%; | ||
`; | ||
|
||
export const BottomRow = styled.div` | ||
display: flex; | ||
width: 100%; | ||
`; | ||
|
||
export const MainMenuToggle = styled(Button)` | ||
svg { | ||
height: 20px; | ||
} | ||
` | ||
|
||
export const TocToggle = styled(Button)` | ||
svg { | ||
height: 20px; | ||
} | ||
` |
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
Oops, something went wrong.