@@ -72,49 +72,54 @@ export interface State {
72
72
color ?: 'card' | 'primary'
73
73
}
74
74
75
- const css = stylesheet ( {
76
- card : {
77
- display : 'flex' ,
78
- flexDirection : 'column'
79
- } ,
80
- title : {
81
- color : cssVar ( '$themePrimary' )
82
- } ,
83
- icon : {
84
- fontSize : 56 ,
85
- display : 'flex' ,
86
- justifyContent : 'center'
87
- } ,
88
- header : {
89
- padding : padding ( 24 , 24 , 0 ) ,
90
- textAlign : 'center'
91
- } ,
92
- img : {
93
- maxHeight : 100
94
- } ,
95
- brand : {
96
- marginBottom : 10
97
- } ,
98
- secondaryItems : {
99
- padding : 24 ,
100
- } ,
101
- persona : {
102
- $nest : {
103
- '.ms-Persona' : {
104
- flexDirection : 'column' ,
105
- height : 'auto' ,
106
- } ,
107
- '.ms-Persona-details' : {
108
- alignItems : 'center' ,
109
- padding : 0
75
+ const
76
+ css = stylesheet ( {
77
+ card : {
78
+ display : 'flex' ,
79
+ flexDirection : 'column'
80
+ } ,
81
+ title : {
82
+ color : cssVar ( '$themePrimary' )
83
+ } ,
84
+ icon : {
85
+ fontSize : 56 ,
86
+ display : 'flex' ,
87
+ justifyContent : 'center'
88
+ } ,
89
+ header : {
90
+ padding : padding ( 24 , 24 , 0 ) ,
91
+ textAlign : 'center'
92
+ } ,
93
+ img : {
94
+ maxHeight : 100
95
+ } ,
96
+ brand : {
97
+ marginBottom : 10
98
+ } ,
99
+ secondaryItems : {
100
+ padding : 24 ,
101
+ } ,
102
+ persona : {
103
+ $nest : {
104
+ '.ms-Persona' : {
105
+ flexDirection : 'column' ,
106
+ height : 'auto' ,
107
+ } ,
108
+ '.ms-Persona-details' : {
109
+ alignItems : 'center' ,
110
+ padding : 0
111
+ } ,
112
+ '.ms-Persona-primaryText' : {
113
+ fontWeight : 500 ,
114
+ marginTop : 12 ,
115
+ }
110
116
} ,
111
- '.ms-Persona-primaryText' : {
112
- fontWeight : 500 ,
113
- marginTop : 12 ,
114
- }
115
117
} ,
116
- } ,
117
- } )
118
+ } ) ,
119
+ getUrl = ( name : S ) => {
120
+ const { origin, pathname } = window . location
121
+ return name . startsWith ( '#' ) ? origin + pathname + name : ''
122
+ }
118
123
119
124
export const
120
125
XNav = ( { items, hideNav, linksOnly = false , valueB } : State & { hideNav ?: ( ) => void , linksOnly ?: B , valueB : Box < S | undefined > } ) => {
@@ -131,8 +136,10 @@ export const
131
136
opacity : disabled ? 0.7 : undefined ,
132
137
marginTop : ! linksOnly && idx === 0 && ! g . label ? 30 : undefined
133
138
} ,
134
- url : '' ,
135
- onClick : ( ) => {
139
+ url : path || getUrl ( name ) ,
140
+ onClick : ( ev ) => {
141
+ ev ?. preventDefault ( )
142
+ if ( ev ?. ctrlKey || ev ?. metaKey ) return
136
143
valueB ( name )
137
144
if ( hideNav ) hideNav ( )
138
145
if ( path ) window . open ( path , "_blank" )
0 commit comments