Skip to content

Commit 88fafe3

Browse files
committed
WIP(ui-top-nav-bar): add lightMode
1 parent 72b7733 commit 88fafe3

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

packages/__docs__/src/App/index.tsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
} from 'react'
3434

3535
import { Alert } from '@instructure/ui-alerts'
36+
import { Checkbox } from '@instructure/ui-checkbox'
3637
import { InstUISettingsProvider, withStyle, jsx } from '@instructure/emotion'
3738
import { Flex } from '@instructure/ui-flex'
3839
import { Text } from '@instructure/ui-text'
@@ -55,7 +56,6 @@ import {
5556
IconUserLine,
5657
IconXSolid
5758
} from '@instructure/ui-icons'
58-
5959
import { ContentWrap } from '../ContentWrap'
6060
import { Document } from '../Document'
6161
import { Header } from '../Header'
@@ -69,7 +69,6 @@ import { Icons } from '../Icons'
6969
import { compileMarkdown } from '../compileMarkdown'
7070

7171
import { fetchVersionData, versionInPath } from '../versionData'
72-
7372
import generateStyle from './styles'
7473
import generateComponentTheme from './theme'
7574
import { LoadingScreen } from '../LoadingScreen'
@@ -126,7 +125,8 @@ class App extends Component<AppProps, AppState> {
126125
layout: 'large',
127126
docsData: null,
128127
versionsData: null,
129-
iconsData: null
128+
iconsData: null,
129+
lightMode: true
130130
}
131131
}
132132

@@ -734,7 +734,6 @@ class App extends Component<AppProps, AppState> {
734734
return <LoadingScreen />
735735
}
736736

737-
const lightMode = false
738737
const brandSvg = (
739738
<IconButton
740739
screenReaderLabel="Canvas Brand"
@@ -770,27 +769,27 @@ class App extends Component<AppProps, AppState> {
770769
boxSizing: 'border-box'
771770
}}
772771
>
773-
<MobileTopNav brand={brandSvg} lightMode={lightMode}>
772+
<MobileTopNav brand={brandSvg} lightMode={this.state.lightMode}>
774773
<MobileTopNav.BtnRow>
775774
<IconButton
776775
withBackground={false}
777776
withBorder={false}
778777
screenReaderLabel="burgir"
779-
color={lightMode ? 'secondary' : 'primary-inverse'}
778+
color={this.state.lightMode ? 'secondary' : 'primary-inverse'}
780779
>
781780
<IconAnalyticsLine />
782781
</IconButton>
783782
<IconButton
784783
withBackground={false}
785784
withBorder={false}
786785
screenReaderLabel="burgir"
787-
color={lightMode ? 'secondary' : 'primary-inverse'}
786+
color={this.state.lightMode ? 'secondary' : 'primary-inverse'}
788787
>
789788
<IconAlertsLine />
790789
</IconButton>
791790
</MobileTopNav.BtnRow>
792791
<MobileTopNav.BreadCrumb>
793-
<Link href="#" isWithinText={false} color="link-inverse">
792+
<Link href="#" isWithinText={false} color={this.state.lightMode ? 'link' : 'link-inverse'}>
794793
<div
795794
style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
796795
>
@@ -822,8 +821,28 @@ class App extends Component<AppProps, AppState> {
822821
>
823822
Dashboard
824823
</MobileTopNav.Item>
824+
<MobileTopNav.Item
825+
rightIcon={<IconArrowOpenDownLine />}
826+
onClick={() => alert('Simple option with no left icon')}
827+
>
828+
Simple option with no left icon
829+
</MobileTopNav.Item>
825830
</MobileTopNav.ItemList>
826831
</MobileTopNav>
832+
<div style={{ marginTop: '600px' }}>
833+
<Checkbox
834+
label="Light mode"
835+
value="small"
836+
variant="toggle"
837+
size="large"
838+
checked={this.state.lightMode}
839+
onChange={(e) => {
840+
this.setState((prevState) => {
841+
return { ...prevState, lightMode: !prevState.lightMode }
842+
})
843+
}}
844+
/>
845+
</div>
827846
<p>
828847
1 Lorem ipsum dolor sit, amet consectetur adipisicing elit.
829848
Molestias excepturi a blanditiis, aspernatur repellat repellendus

packages/__docs__/src/App/props.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type AppState = {
8686
changelogData?: DocData
8787
// the currently shown document
8888
currentDocData?: DocData
89+
lightMode: boolean
8990
}
9091

9192
type DocData = ProcessedFile & {

packages/ui-top-nav-bar/src/MobileTopNav/styles.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
import type { MobileTopNavProps } from './props'
2525

26+
//TODO use theme variables for spacing
2627
const generateStyles = (props: MobileTopNavProps, theme: any) => {
2728
const { lightMode } = props
2829
return {
@@ -36,7 +37,8 @@ const generateStyles = (props: MobileTopNavProps, theme: any) => {
3637
color: lightMode
3738
? theme.colors.contrasts.grey125125
3839
: theme.colors?.contrasts?.white1010,
39-
width: '100%'
40+
width: '100%',
41+
zIndex: '1000'
4042
}
4143
},
4244
topBar: {

0 commit comments

Comments
 (0)