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

wip: mobile topnav poc #1644

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
403 changes: 2 additions & 401 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/__docs__/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ export { ToggleBlockquote } from './src/ToggleBlockquote'
export { InstUISettingsProvider } from '@instructure/emotion'
export { Drilldown } from '@instructure/ui-drilldown'
export { SourceCodeEditor } from '@instructure/ui-source-code-editor'
export { TopNavBar } from '@instructure/ui-top-nav-bar'
export { TopNavBar, MobileTopNav } from '@instructure/ui-top-nav-bar'
export { TruncateList } from '@instructure/ui-truncate-list'
export { canvas, canvasHighContrast, instructure } from '@instructure/ui-themes'
250 changes: 213 additions & 37 deletions packages/__docs__/src/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/jsx-no-undef */
/*
* The MIT License (MIT)
*
Expand Down Expand Up @@ -32,25 +33,26 @@ import {
} from 'react'

import { Alert } from '@instructure/ui-alerts'
import {
InstUISettingsProvider,
withStyle,
jsx,
Global
} from '@instructure/emotion'
import { InstUISettingsProvider, withStyle, jsx } from '@instructure/emotion'
import { Flex } from '@instructure/ui-flex'
import { Text } from '@instructure/ui-text'
import { View } from '@instructure/ui-view'
import { AccessibleContent } from '@instructure/ui-a11y-content'
import { Mask } from '@instructure/ui-overlays'
import { MobileTopNav } from '@instructure/ui-top-nav-bar'
import { IconButton } from '@instructure/ui-buttons'
import { Tray } from '@instructure/ui-tray'
import { Link } from '@instructure/ui-link'
import { addMediaQueryMatchListener } from '@instructure/ui-responsive'
import type { QueriesMatching } from '@instructure/ui-responsive'
import {
IconHamburgerSolid,
IconAdminLine,
IconAlertsLine,
IconAnalyticsLine,
IconArrowOpenDownLine,
IconArrowOpenStartLine,
IconDashboardLine,
IconHeartLine,
IconUserLine,
IconXSolid
} from '@instructure/ui-icons'

Expand Down Expand Up @@ -731,6 +733,27 @@ class App extends Component<AppProps, AppState> {
if (!docsData || !iconsData) {
return <LoadingScreen />
}

const lightMode = false
const brandSvg = (
<IconButton
screenReaderLabel="Canvas Brand"
href="#"
withBackground={false}
withBorder={false}
>
<svg
viewBox="0 0 1920 1920"
xmlns="http://www.w3.org/2000/svg"
fill="#fff"
width="28px"
height="28px"
>
<path d="M958.568 277.97C1100.42 277.97 1216.48 171.94 1233.67 34.3881 1146.27 12.8955 1054.57 0 958.568 0 864.001 0 770.867 12.8955 683.464 34.3881 700.658 171.94 816.718 277.97 958.568 277.97ZM35.8207 682.031C173.373 699.225 279.403 815.285 279.403 957.136 279.403 1098.99 173.373 1215.05 35.8207 1232.24 12.8953 1144.84 1.43262 1051.7 1.43262 957.136 1.43262 862.569 12.8953 769.434 35.8207 682.031ZM528.713 957.142C528.713 1005.41 489.581 1044.55 441.31 1044.55 393.038 1044.55 353.907 1005.41 353.907 957.142 353.907 908.871 393.038 869.74 441.31 869.74 489.581 869.74 528.713 908.871 528.713 957.142ZM1642.03 957.136C1642.03 1098.99 1748.06 1215.05 1885.61 1232.24 1908.54 1144.84 1920 1051.7 1920 957.136 1920 862.569 1908.54 769.434 1885.61 682.031 1748.06 699.225 1642.03 815.285 1642.03 957.136ZM1567.51 957.142C1567.51 1005.41 1528.38 1044.55 1480.11 1044.55 1431.84 1044.55 1392.71 1005.41 1392.71 957.142 1392.71 908.871 1431.84 869.74 1480.11 869.74 1528.38 869.74 1567.51 908.871 1567.51 957.142ZM958.568 1640.6C816.718 1640.6 700.658 1746.63 683.464 1884.18 770.867 1907.11 864.001 1918.57 958.568 1918.57 1053.14 1918.57 1146.27 1907.11 1233.67 1884.18 1216.48 1746.63 1100.42 1640.6 958.568 1640.6ZM1045.98 1480.11C1045.98 1528.38 1006.85 1567.51 958.575 1567.51 910.304 1567.51 871.172 1528.38 871.172 1480.11 871.172 1431.84 910.304 1392.71 958.575 1392.71 1006.85 1392.71 1045.98 1431.84 1045.98 1480.11ZM1045.98 439.877C1045.98 488.148 1006.85 527.28 958.575 527.28 910.304 527.28 871.172 488.148 871.172 439.877 871.172 391.606 910.304 352.474 958.575 352.474 1006.85 352.474 1045.98 391.606 1045.98 439.877ZM1441.44 1439.99C1341.15 1540.29 1333.98 1697.91 1418.52 1806.8 1579 1712.23 1713.68 1577.55 1806.82 1418.5 1699.35 1332.53 1541.74 1339.7 1441.44 1439.99ZM1414.21 1325.37C1414.21 1373.64 1375.08 1412.77 1326.8 1412.77 1278.53 1412.77 1239.4 1373.64 1239.4 1325.37 1239.4 1277.1 1278.53 1237.97 1326.8 1237.97 1375.08 1237.97 1414.21 1277.1 1414.21 1325.37ZM478.577 477.145C578.875 376.846 586.039 219.234 501.502 110.339 341.024 204.906 206.338 339.592 113.203 498.637 220.666 584.607 378.278 576.01 478.577 477.145ZM679.155 590.32C679.155 638.591 640.024 677.723 591.752 677.723 543.481 677.723 504.349 638.591 504.349 590.32 504.349 542.048 543.481 502.917 591.752 502.917 640.024 502.917 679.155 542.048 679.155 590.32ZM1440 475.712C1540.3 576.01 1697.91 583.174 1806.8 498.637 1712.24 338.159 1577.55 203.473 1418.51 110.339 1332.54 217.801 1341.13 375.413 1440 475.712ZM1414.21 590.32C1414.21 638.591 1375.08 677.723 1326.8 677.723 1278.53 677.723 1239.4 638.591 1239.4 590.32 1239.4 542.048 1278.53 502.917 1326.8 502.917 1375.08 502.917 1414.21 542.048 1414.21 590.32ZM477.145 1438.58C376.846 1338.28 219.234 1331.12 110.339 1415.65 204.906 1576.13 339.593 1710.82 498.637 1805.39 584.607 1696.49 577.443 1538.88 477.145 1438.58ZM679.155 1325.37C679.155 1373.64 640.024 1412.77 591.752 1412.77 543.481 1412.77 504.349 1373.64 504.349 1325.37 504.349 1277.1 543.481 1237.97 591.752 1237.97 640.024 1237.97 679.155 1277.1 679.155 1325.37Z" />
</svg>
</IconButton>
)

return (
<AppContext.Provider
value={{
Expand All @@ -739,36 +762,189 @@ class App extends Component<AppProps, AppState> {
themes: docsData.themes
}}
>
<div css={this.props.styles?.app}>
<Global styles={this.props.styles?.globalStyles} />
{showMenu && layout === 'small' && (
<Mask onClick={this.handleMenuClose} />
)}
{this.renderNavigation()}
<div
css={this.props.styles?.content}
aria-label={key || docsData.library.name}
role="main"
ref={this.handleContentRef}
>
{!showMenu && (
<div css={this.props.styles?.hamburger}>
<InstUISettingsProvider>
<IconButton
onClick={this.handleMenuOpen}
elementRef={this.handleMenuTriggerRef}
renderIcon={IconHamburgerSolid}
screenReaderLabel="Open Navigation"
shape="circle"
/>
</InstUISettingsProvider>
</div>
)}
{this.renderContent(key)}
{this.renderFooter()}
</div>
<div
style={{
position: 'relative',
width: '100%',
maxWidth: '100%',
boxSizing: 'border-box'
}}
>
<MobileTopNav brand={brandSvg} lightMode={lightMode}>
<MobileTopNav.BtnRow>
<IconButton
withBackground={false}
withBorder={false}
screenReaderLabel="burgir"
color={lightMode ? 'secondary' : 'primary-inverse'}
>
<IconAnalyticsLine />
</IconButton>
<IconButton
withBackground={false}
withBorder={false}
screenReaderLabel="burgir"
color={lightMode ? 'secondary' : 'primary-inverse'}
>
<IconAlertsLine />
</IconButton>
</MobileTopNav.BtnRow>
<MobileTopNav.BreadCrumb>
<Link href="#" isWithinText={false} color="link-inverse">
<div
style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
>
<IconArrowOpenStartLine />
Back
</div>
</Link>
</MobileTopNav.BreadCrumb>
<MobileTopNav.Title>Courses</MobileTopNav.Title>
<MobileTopNav.ItemList>
<MobileTopNav.Item
leftIcon={<IconUserLine />}
rightIcon={<IconArrowOpenDownLine />}
onClick={() => alert('Account clicked')}
>
Account
</MobileTopNav.Item>
<MobileTopNav.Item
leftIcon={<IconAdminLine />}
rightIcon={<IconArrowOpenDownLine />}
onClick={() => alert('Admin clicked')}
>
Admin
</MobileTopNav.Item>
<MobileTopNav.Item
leftIcon={<IconDashboardLine />}
rightIcon={<IconArrowOpenDownLine />}
onClick={() => alert('Dashboard')}
>
Dashboard
</MobileTopNav.Item>
</MobileTopNav.ItemList>
</MobileTopNav>
<p>
1 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
2 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
3 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
4 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
5 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
6 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
7 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
8 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
9 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
10 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
11 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
12 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
13 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
14 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
15 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
16 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
17 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
18 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
19 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
<p>
20 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Molestias excepturi a blanditiis, aspernatur repellat repellendus
dolores cum labore eligendi architecto asperiores, dolor quisquam
sequi mollitia quibusdam, cumque id ab amet?
</p>
</div>
{this.renderLegacyDocWarning()}
</AppContext.Provider>
)
}
Expand Down
3 changes: 3 additions & 0 deletions packages/__docs__/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont,
'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
'Droid Sans', 'Helvetica Neue', sans-serif;
padding: 0;
margin: 0;
box-sizing: border-box;
}

#app {
Expand Down
8 changes: 3 additions & 5 deletions packages/__docs__/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import { InstUISettingsProvider } from '@instructure/emotion'
import '../globals'

createRoot(document.getElementById('app')).render(
<React.StrictMode>
<InstUISettingsProvider>
<App />
</InstUISettingsProvider>
</React.StrictMode>
<InstUISettingsProvider>
<App />
</InstUISettingsProvider>
)
Loading
Loading