@@ -39,10 +39,15 @@ import {
3939} from '@instructure/ui-icons'
4040import generateStyle from './styles'
4141import generateComponentTheme from './theme'
42+ import { Flex } from '@instructure/ui-flex'
43+ import { Heading } from '@instructure/ui-heading'
44+ import { CloseButton } from '@instructure/ui-buttons'
45+ import { Tray } from '@instructure/ui-tray'
4246import { Img } from '@instructure/ui-img'
4347import { View } from '@instructure/ui-view'
4448import { SideNavBar } from '@instructure/ui-side-nav-bar'
4549import { ScreenReaderContent } from '@instructure/ui-a11y-content'
50+ import Link from '../Link'
4651
4752type AppProps = {
4853 navigate : ( path : string , options ?: { replace : boolean } ) => void
@@ -58,14 +63,23 @@ class App extends Component<AppProps, AppState> {
5863 super ( props )
5964
6065 this . state = {
61- windowWidth : window . innerWidth
66+ windowWidth : window . innerWidth ,
67+ open : false
6268 }
6369 }
6470
6571 isCoursePage ( ) {
6672 return location . pathname . startsWith ( '/course' )
6773 }
6874
75+ isAccountPage ( ) {
76+ return location . pathname . startsWith ( '/account' )
77+ }
78+
79+ isDashboardPage ( ) {
80+ return location . pathname . startsWith ( '/dashboard' )
81+ }
82+
6983 componentDidMount ( ) {
7084 window . addEventListener ( 'resize' , this . handleResize )
7185 }
@@ -78,6 +92,28 @@ class App extends Component<AppProps, AppState> {
7892 this . setState ( { windowWidth : window . innerWidth } )
7993 }
8094
95+ renderCloseButton ( ) {
96+ return (
97+ < Flex >
98+ < Flex . Item shouldGrow shouldShrink >
99+ < Heading > Hello</ Heading >
100+ </ Flex . Item >
101+ < Flex . Item >
102+ < CloseButton
103+ placement = "end"
104+ offset = "small"
105+ screenReaderLabel = "Close"
106+ onClick = { ( ) => {
107+ this . setState ( {
108+ open : false
109+ } )
110+ } }
111+ />
112+ </ Flex . Item >
113+ </ Flex >
114+ )
115+ }
116+
81117 render ( ) {
82118 const isMobile = this . state . windowWidth < 768
83119
@@ -196,7 +232,7 @@ class App extends Component<AppProps, AppState> {
196232 boxSizing : 'border-box'
197233 } }
198234 >
199- < div style = { { height : '100vh' } } >
235+ < div style = { { height : '100vh' , zIndex : 100 } } >
200236 { ! isMobile && (
201237 < SideNavBar
202238 label = "Main navigation"
@@ -219,20 +255,24 @@ class App extends Component<AppProps, AppState> {
219255 onClick = { ( ) =>
220256 this . props . navigate ( '/account' , { replace : true } )
221257 }
258+ selected = { this . isAccountPage ( ) }
222259 />
223260 < SideNavBar . Item
224261 icon = { < IconCoursesLine /> }
225262 label = "Courses"
226- onClick = { ( ) =>
263+ onClick = { ( ) => {
227264 this . props . navigate ( '/course1' , { replace : true } )
228- }
265+ this . setState ( { open : true } )
266+ } }
267+ selected = { this . isCoursePage ( ) }
229268 />
230269 < SideNavBar . Item
231270 icon = { < IconDashboardLine /> }
232271 label = "Dashboard"
233272 onClick = { ( ) =>
234273 this . props . navigate ( '/dashboard' , { replace : true } )
235274 }
275+ selected = { this . isDashboardPage ( ) }
236276 />
237277 < SideNavBar . Item
238278 icon = { < IconQuestionLine /> }
@@ -285,6 +325,28 @@ class App extends Component<AppProps, AppState> {
285325 ] }
286326 mobileMenu = { menuArray }
287327 />
328+ < Tray
329+ label = "Tray Example"
330+ open = { this . state . open }
331+ onDismiss = { ( ) => {
332+ this . setState ( { open : false } )
333+ } }
334+ size = "small"
335+ placement = "start"
336+ themeOverride = { { zIndex : 1 } }
337+ >
338+ { this . renderCloseButton ( ) }
339+
340+ < div style = { { marginLeft : '100px' } } >
341+ < h1 > Courses</ h1 >
342+ < Link href = "/course1" display = "block" >
343+ Course 1
344+ </ Link >
345+ < Link href = "/course2" display = "block" >
346+ Course 2
347+ </ Link >
348+ </ div >
349+ </ Tray >
288350 < div style = { { display : 'flex' } } >
289351 { this . isCoursePage ( ) && (
290352 < SubNav
0 commit comments