File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed
packages/ui-top-nav-bar/src/SubNav Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -28,19 +28,20 @@ import { jsx, useTheme } from '@instructure/emotion'
2828
2929import { generateStyles } from './styles'
3030import { Link } from '@instructure/ui-link'
31+ import { SubNavProps , MenuItem } from './props'
3132
3233/**
3334---
3435category: components
3536---
3637 **/
37- const SubNav = ( { menuItems, styles } : any ) => {
38+ const SubNav = ( { menuItems, styles } : SubNavProps ) => {
3839 return (
3940 < div style = { styles . container } >
40- { menuItems . map ( ( item : any ) => (
41- < div style = { styles . linkContainer ( item ) } key = { item } >
41+ { menuItems . map ( ( item : MenuItem ) => (
42+ < div style = { styles . linkContainer ( item ) } key = { item . title } >
4243 < Link
43- key = { item }
44+ key = { item . title }
4445 href = { item . href }
4546 themeOverride = { styles . link ( item ) }
4647 isWithinText = { false }
Original file line number Diff line number Diff line change 2222 * SOFTWARE.
2323 */
2424
25- import type { ReactNode , PropsWithChildren } from 'react'
25+ type MenuItem = {
26+ href : string
27+ title : string
28+ selected : boolean
29+ onClick ?: ( ) => void
30+ }
2631
2732type SubNavOwnProps = {
28- lightMode ?: boolean
29- brand ?: ReactNode
33+ menuItems : MenuItem [ ]
3034}
3135
3236type SubNavStyle = {
3337 container : {
3438 [ key : string ] : string | number
3539 }
36- content : ( open : boolean ) => {
37- [ key : string ] : string | number
38- }
39- topBar : {
40+ linkContainer : ( item : MenuItem ) => {
4041 [ key : string ] : string | number
4142 }
42- btnRow : {
43+ link : ( item : MenuItem ) => {
4344 [ key : string ] : string | number
4445 }
4546}
4647
4748type SubNavProps = SubNavOwnProps & {
4849 styles : SubNavStyle
49- } & PropsWithChildren
50+ }
5051
51- export type { SubNavProps , SubNavOwnProps }
52+ export type { SubNavProps , SubNavOwnProps , MenuItem }
You can’t perform that action at this time.
0 commit comments