@instructure/ui-top-nav-bar 8.56.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +0 -3
- package/es/TopNavBar/TopNavBarBrand/index.js +11 -13
- package/es/TopNavBar/TopNavBarBrand/props.js +1 -3
- package/es/TopNavBar/TopNavBarBrand/styles.js +1 -11
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.js +4 -132
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +5 -7
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.js +1 -2
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +1 -1
- package/es/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.js +0 -18
- package/es/TopNavBar/TopNavBarLayout/index.js +6 -4
- package/es/TopNavBar/TopNavBarLayout/props.js +1 -2
- package/es/TopNavBar/__new-tests__/TopNavBar.test.js +0 -1
- package/es/TopNavBar/utils/exampleHelpers.js +1 -8
- package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +0 -3
- package/lib/TopNavBar/TopNavBarBrand/index.js +10 -13
- package/lib/TopNavBar/TopNavBarBrand/props.js +1 -3
- package/lib/TopNavBar/TopNavBarBrand/styles.js +1 -11
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.js +3 -131
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +4 -7
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.js +1 -2
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +1 -1
- package/lib/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.js +0 -18
- package/lib/TopNavBar/TopNavBarLayout/index.js +6 -4
- package/lib/TopNavBar/TopNavBarLayout/props.js +1 -2
- package/lib/TopNavBar/__new-tests__/TopNavBar.test.js +0 -1
- package/lib/TopNavBar/utils/exampleHelpers.js +0 -7
- package/package.json +30 -30
- package/src/TopNavBar/README.md +2 -248
- package/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts +0 -3
- package/src/TopNavBar/TopNavBarBrand/index.tsx +17 -22
- package/src/TopNavBar/TopNavBarBrand/props.ts +1 -21
- package/src/TopNavBar/TopNavBarBrand/styles.ts +1 -10
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.tsx +3 -173
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +2 -10
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts +3 -5
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.tsx +2 -2
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +1 -4
- package/src/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.tsx +0 -25
- package/src/TopNavBar/TopNavBarLayout/index.tsx +10 -3
- package/src/TopNavBar/TopNavBarLayout/props.ts +0 -7
- package/src/TopNavBar/__new-tests__/TopNavBar.test.tsx +0 -1
- package/src/TopNavBar/utils/exampleHelpers.tsx +1 -15
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts +1 -6
- package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBrand/props.d.ts +1 -10
- package/types/TopNavBar/TopNavBarBrand/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBrand/styles.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts +2 -2
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/index.d.ts +3 -3
- package/types/TopNavBar/TopNavBarLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/props.d.ts +0 -4
- package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -1
- package/types/TopNavBar/utils/exampleHelpers.d.ts +0 -2
- package/types/TopNavBar/utils/exampleHelpers.d.ts.map +1 -1
package/src/TopNavBar/README.md
CHANGED
|
@@ -24,11 +24,8 @@ class PlaygroundExample extends React.Component {
|
|
|
24
24
|
hasMenuItemsSection: true,
|
|
25
25
|
hasActionItemsSection: true,
|
|
26
26
|
hasUserSection: true,
|
|
27
|
-
hideActionsUserSeparator: true,
|
|
28
27
|
useAlternativeTitle: false,
|
|
29
|
-
renderName: true,
|
|
30
28
|
renderIcon: true,
|
|
31
|
-
nameBackground: false,
|
|
32
29
|
iconBackground: true,
|
|
33
30
|
extraMenuItems: false,
|
|
34
31
|
extraActionItems: false,
|
|
@@ -308,12 +305,6 @@ class PlaygroundExample extends React.Component {
|
|
|
308
305
|
'hasUserSection',
|
|
309
306
|
]
|
|
310
307
|
},
|
|
311
|
-
desktopLayout: {
|
|
312
|
-
label: 'Desktop layout settings',
|
|
313
|
-
checkboxes: [
|
|
314
|
-
'hideActionsUserSeparator'
|
|
315
|
-
]
|
|
316
|
-
},
|
|
317
308
|
smallViewportLayout: {
|
|
318
309
|
label: 'Small viewport layout settings',
|
|
319
310
|
checkboxes: [
|
|
@@ -323,9 +314,7 @@ class PlaygroundExample extends React.Component {
|
|
|
323
314
|
brand: {
|
|
324
315
|
label: 'TopNavBar.Brand settings',
|
|
325
316
|
checkboxes: [
|
|
326
|
-
'renderName',
|
|
327
317
|
'renderIcon',
|
|
328
|
-
'nameBackground',
|
|
329
318
|
'iconBackground',
|
|
330
319
|
]
|
|
331
320
|
},
|
|
@@ -399,11 +388,8 @@ class PlaygroundExample extends React.Component {
|
|
|
399
388
|
hasMenuItemsSection: 'Displays main navbar items',
|
|
400
389
|
hasActionItemsSection: 'Displays action items',
|
|
401
390
|
hasUserSection: 'Displays user menu',
|
|
402
|
-
hideActionsUserSeparator: 'Hides the separator between the action items and the user menu',
|
|
403
391
|
useAlternativeTitle: 'Displays other data (e.g.: page title) instead of the Brand logo and link',
|
|
404
|
-
renderName: 'The app/product/brand/company/etc. name',
|
|
405
392
|
renderIcon: 'Visible only in "desktop" mode',
|
|
406
|
-
nameBackground: 'Visible only in "desktop" mode',
|
|
407
393
|
iconBackground: 'Visible only in "desktop" mode',
|
|
408
394
|
extraMenuItems: 'In "desktop" mode, when there is not enough room to list all the menu items, they will be accessible via a dropdown menu at the end of the list',
|
|
409
395
|
actionItemShowChevronForSubmenu: 'Displays the open/close chevron next to the item, when it has a submenu or custom popover',
|
|
@@ -604,9 +590,6 @@ class PlaygroundExample extends React.Component {
|
|
|
604
590
|
navLabel={this.state.isSecondaryNavigation
|
|
605
591
|
? 'Secondary navigation bar'
|
|
606
592
|
: 'Main navigation bar'}
|
|
607
|
-
desktopConfig={{
|
|
608
|
-
hideActionsUserSeparator: this.state.hideActionsUserSeparator
|
|
609
|
-
}}
|
|
610
593
|
smallViewportConfig={{
|
|
611
594
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
612
595
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -632,11 +615,6 @@ class PlaygroundExample extends React.Component {
|
|
|
632
615
|
screenReaderLabel="Elevate Data Sync"
|
|
633
616
|
href="/#TopNavBar"
|
|
634
617
|
{...{
|
|
635
|
-
...(this.state.renderName && {
|
|
636
|
-
renderName: inverseColor
|
|
637
|
-
? elevateLogoInverse
|
|
638
|
-
: elevateLogo
|
|
639
|
-
}),
|
|
640
618
|
...(this.state.renderIcon && {
|
|
641
619
|
renderIcon: inverseColor
|
|
642
620
|
? undefined
|
|
@@ -645,11 +623,6 @@ class PlaygroundExample extends React.Component {
|
|
|
645
623
|
...(this.state.iconBackground && {
|
|
646
624
|
iconBackground: '#0097D3'
|
|
647
625
|
}),
|
|
648
|
-
...(this.state.nameBackground && {
|
|
649
|
-
nameBackground: inverseColor
|
|
650
|
-
? '#F5F5F5'
|
|
651
|
-
: '#2D3B45'
|
|
652
|
-
}),
|
|
653
626
|
}}
|
|
654
627
|
/>
|
|
655
628
|
) : undefined }
|
|
@@ -1108,7 +1081,7 @@ render(<PlaygroundExample />)
|
|
|
1108
1081
|
|
|
1109
1082
|
TopNavBar is a responsive component, and it has 4 "sections" or "blocks".
|
|
1110
1083
|
|
|
1111
|
-
The `<TopNavBar.Layout>` component has a `
|
|
1084
|
+
The `<TopNavBar.Layout>` component has a `smallViewportConfig` prop that handles how the mobile viewport is set up.
|
|
1112
1085
|
|
|
1113
1086
|
#### Main blocks
|
|
1114
1087
|
|
|
@@ -1116,9 +1089,7 @@ The `<TopNavBar.Layout>` component has a `desktopConfig` and a `smallViewportCon
|
|
|
1116
1089
|
|
|
1117
1090
|
`<TopNavBar.Brand>` contains the brand logo and icon.
|
|
1118
1091
|
|
|
1119
|
-
Use the brand logo over the primary brand color
|
|
1120
|
-
|
|
1121
|
-
**Note**: A console warning is thrown if the `renderName` prop of `<TopNavBar.Brand>` is used because it will be removed soon in Instructure UI v9. Please adjust the TopNavBar design in places, where you use `renderName` with `<TopNavBar.Brand>`.
|
|
1092
|
+
Use the brand logo over the primary brand color.
|
|
1122
1093
|
|
|
1123
1094
|
```js
|
|
1124
1095
|
---
|
|
@@ -1130,9 +1101,6 @@ type: example
|
|
|
1130
1101
|
{() => (
|
|
1131
1102
|
<TopNavBar.Layout
|
|
1132
1103
|
navLabel="Example navigation bar"
|
|
1133
|
-
desktopConfig={{
|
|
1134
|
-
hideActionsUserSeparator: false
|
|
1135
|
-
}}
|
|
1136
1104
|
smallViewportConfig={{
|
|
1137
1105
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1138
1106
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1140,29 +1108,6 @@ type: example
|
|
|
1140
1108
|
renderBrand={(
|
|
1141
1109
|
<TopNavBar.Brand
|
|
1142
1110
|
screenReaderLabel="Brand name"
|
|
1143
|
-
renderName={(
|
|
1144
|
-
<View as="div" minWidth="7rem">
|
|
1145
|
-
<Text
|
|
1146
|
-
as="div"
|
|
1147
|
-
color="primary-inverse"
|
|
1148
|
-
transform="uppercase"
|
|
1149
|
-
size="small"
|
|
1150
|
-
weight="bold"
|
|
1151
|
-
lineHeight="condensed"
|
|
1152
|
-
>
|
|
1153
|
-
Brand
|
|
1154
|
-
</Text>
|
|
1155
|
-
<Text
|
|
1156
|
-
as="div"
|
|
1157
|
-
color="primary-inverse"
|
|
1158
|
-
size="large"
|
|
1159
|
-
weight="normal"
|
|
1160
|
-
lineHeight="condensed"
|
|
1161
|
-
>
|
|
1162
|
-
Sub-brand
|
|
1163
|
-
</Text>
|
|
1164
|
-
</View>
|
|
1165
|
-
)}
|
|
1166
1111
|
renderIcon={(
|
|
1167
1112
|
<IconBoldLine
|
|
1168
1113
|
size="small"
|
|
@@ -1185,9 +1130,6 @@ type: example
|
|
|
1185
1130
|
{() => (
|
|
1186
1131
|
<TopNavBar.Layout
|
|
1187
1132
|
navLabel="Example navigation bar"
|
|
1188
|
-
desktopConfig={{
|
|
1189
|
-
hideActionsUserSeparator: false
|
|
1190
|
-
}}
|
|
1191
1133
|
smallViewportConfig={{
|
|
1192
1134
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1193
1135
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1195,30 +1137,6 @@ type: example
|
|
|
1195
1137
|
renderBrand={(
|
|
1196
1138
|
<TopNavBar.Brand
|
|
1197
1139
|
screenReaderLabel="Brand name"
|
|
1198
|
-
renderName={(
|
|
1199
|
-
<View as="div" minWidth="7rem">
|
|
1200
|
-
<Text
|
|
1201
|
-
as="div"
|
|
1202
|
-
color="primary-inverse"
|
|
1203
|
-
transform="uppercase"
|
|
1204
|
-
size="small"
|
|
1205
|
-
weight="bold"
|
|
1206
|
-
lineHeight="condensed"
|
|
1207
|
-
>
|
|
1208
|
-
Brand
|
|
1209
|
-
</Text>
|
|
1210
|
-
<Text
|
|
1211
|
-
as="div"
|
|
1212
|
-
color="primary-inverse"
|
|
1213
|
-
size="large"
|
|
1214
|
-
weight="normal"
|
|
1215
|
-
lineHeight="condensed"
|
|
1216
|
-
>
|
|
1217
|
-
Sub-brand
|
|
1218
|
-
</Text>
|
|
1219
|
-
</View>
|
|
1220
|
-
)}
|
|
1221
|
-
nameBackground="#2D3B45"
|
|
1222
1140
|
href="/#TopNavBar"
|
|
1223
1141
|
/>
|
|
1224
1142
|
)}
|
|
@@ -1257,9 +1175,6 @@ type: example
|
|
|
1257
1175
|
{() => (
|
|
1258
1176
|
<TopNavBar.Layout
|
|
1259
1177
|
navLabel="Example navigation bar"
|
|
1260
|
-
desktopConfig={{
|
|
1261
|
-
hideActionsUserSeparator: false
|
|
1262
|
-
}}
|
|
1263
1178
|
smallViewportConfig={{
|
|
1264
1179
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1265
1180
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1302,9 +1217,6 @@ type: example
|
|
|
1302
1217
|
{() => (
|
|
1303
1218
|
<TopNavBar.Layout
|
|
1304
1219
|
navLabel="Example navigation bar"
|
|
1305
|
-
desktopConfig={{
|
|
1306
|
-
hideActionsUserSeparator: false
|
|
1307
|
-
}}
|
|
1308
1220
|
smallViewportConfig={{
|
|
1309
1221
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1310
1222
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1353,9 +1265,6 @@ type: example
|
|
|
1353
1265
|
{() => (
|
|
1354
1266
|
<TopNavBar.Layout
|
|
1355
1267
|
navLabel="Example navigation bar"
|
|
1356
|
-
desktopConfig={{
|
|
1357
|
-
hideActionsUserSeparator: false
|
|
1358
|
-
}}
|
|
1359
1268
|
smallViewportConfig={{
|
|
1360
1269
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1361
1270
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1417,8 +1326,6 @@ Action items can have submenus and popovers too. It is also recommended to add h
|
|
|
1417
1326
|
|
|
1418
1327
|
**Special case:** The "Search" action should open in a flyout on desktop. On the mobile/tablet view it should fill the header (see the [Playground](/#TopNavBar/#playground) example).
|
|
1419
1328
|
|
|
1420
|
-
If the last action is shown as text and the user is shown as text, use the separator between the 2 blocks, otherwise it is optional (`desktopConfig.hideActionsUserSeparator` prop on the `<TopNavBar.Layout>`).
|
|
1421
|
-
|
|
1422
1329
|
```js
|
|
1423
1330
|
---
|
|
1424
1331
|
type: example
|
|
@@ -1429,9 +1336,6 @@ type: example
|
|
|
1429
1336
|
{() => (
|
|
1430
1337
|
<TopNavBar.Layout
|
|
1431
1338
|
navLabel="Example navigation bar"
|
|
1432
|
-
desktopConfig={{
|
|
1433
|
-
hideActionsUserSeparator: true
|
|
1434
|
-
}}
|
|
1435
1339
|
smallViewportConfig={{
|
|
1436
1340
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1437
1341
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1523,69 +1427,6 @@ type: example
|
|
|
1523
1427
|
)}
|
|
1524
1428
|
</TopNavBar>
|
|
1525
1429
|
</View>
|
|
1526
|
-
|
|
1527
|
-
<View as="div" margin="medium 0">
|
|
1528
|
-
<TopNavBar>
|
|
1529
|
-
{() => (
|
|
1530
|
-
<TopNavBar.Layout
|
|
1531
|
-
navLabel="Example navigation bar"
|
|
1532
|
-
desktopConfig={{
|
|
1533
|
-
hideActionsUserSeparator: false
|
|
1534
|
-
}}
|
|
1535
|
-
smallViewportConfig={{
|
|
1536
|
-
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1537
|
-
dropdownMenuLabel: 'Main Menu',
|
|
1538
|
-
}}
|
|
1539
|
-
renderActionItems={(
|
|
1540
|
-
<TopNavBar.ActionItems
|
|
1541
|
-
listLabel="Actions"
|
|
1542
|
-
renderHiddenItemsMenuTriggerLabel={(
|
|
1543
|
-
hiddenChildrenCount
|
|
1544
|
-
) => `${hiddenChildrenCount} more actions`}
|
|
1545
|
-
>
|
|
1546
|
-
<TopNavBar.Item
|
|
1547
|
-
id="AlertsAction2"
|
|
1548
|
-
renderIcon={<IconAlertsLine />}
|
|
1549
|
-
onClick={() => {
|
|
1550
|
-
console.log('Alerts')
|
|
1551
|
-
}}
|
|
1552
|
-
>
|
|
1553
|
-
Alerts
|
|
1554
|
-
</TopNavBar.Item>
|
|
1555
|
-
<TopNavBar.Item
|
|
1556
|
-
id="ForumAction2"
|
|
1557
|
-
renderIcon={<IconDiscussionLine />}
|
|
1558
|
-
onClick={() => {
|
|
1559
|
-
console.log('Forum')
|
|
1560
|
-
}}
|
|
1561
|
-
>
|
|
1562
|
-
Forum
|
|
1563
|
-
</TopNavBar.Item>
|
|
1564
|
-
<TopNavBar.Item
|
|
1565
|
-
id="InfoAction2"
|
|
1566
|
-
renderIcon={<IconQuestionLine />}
|
|
1567
|
-
onClick={() => {
|
|
1568
|
-
console.log('Info')
|
|
1569
|
-
}}
|
|
1570
|
-
>
|
|
1571
|
-
Info
|
|
1572
|
-
</TopNavBar.Item>
|
|
1573
|
-
</TopNavBar.ActionItems>
|
|
1574
|
-
)}
|
|
1575
|
-
renderUser={(
|
|
1576
|
-
<TopNavBar.User>
|
|
1577
|
-
<TopNavBar.Item
|
|
1578
|
-
id="LogInRegisterButton2"
|
|
1579
|
-
href="/#TopNavBar"
|
|
1580
|
-
>
|
|
1581
|
-
Log In/Register
|
|
1582
|
-
</TopNavBar.Item>
|
|
1583
|
-
</TopNavBar.User>
|
|
1584
|
-
)}
|
|
1585
|
-
/>
|
|
1586
|
-
)}
|
|
1587
|
-
</TopNavBar>
|
|
1588
|
-
</View>
|
|
1589
1430
|
</div>
|
|
1590
1431
|
```
|
|
1591
1432
|
|
|
@@ -1593,8 +1434,6 @@ type: example
|
|
|
1593
1434
|
|
|
1594
1435
|
`<TopNavBar.User>` contains the login/register button and user menu.
|
|
1595
1436
|
|
|
1596
|
-
If the last action is shown as text and the user is shown as text, use the separator between the 2 blocks, otherwise it is optional (`desktopConfig.hideActionsUserSeparator` prop on the `<TopNavBar.Layout>`).
|
|
1597
|
-
|
|
1598
1437
|
```js
|
|
1599
1438
|
---
|
|
1600
1439
|
type: example
|
|
@@ -1605,9 +1444,6 @@ type: example
|
|
|
1605
1444
|
{() => (
|
|
1606
1445
|
<TopNavBar.Layout
|
|
1607
1446
|
navLabel="Example navigation bar"
|
|
1608
|
-
desktopConfig={{
|
|
1609
|
-
hideActionsUserSeparator: false
|
|
1610
|
-
}}
|
|
1611
1447
|
smallViewportConfig={{
|
|
1612
1448
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1613
1449
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1632,9 +1468,6 @@ type: example
|
|
|
1632
1468
|
{() => (
|
|
1633
1469
|
<TopNavBar.Layout
|
|
1634
1470
|
navLabel="Example navigation bar"
|
|
1635
|
-
desktopConfig={{
|
|
1636
|
-
hideActionsUserSeparator: false
|
|
1637
|
-
}}
|
|
1638
1471
|
smallViewportConfig={{
|
|
1639
1472
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1640
1473
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1660,9 +1493,6 @@ type: example
|
|
|
1660
1493
|
{() => (
|
|
1661
1494
|
<TopNavBar.Layout
|
|
1662
1495
|
navLabel="Example navigation bar"
|
|
1663
|
-
desktopConfig={{
|
|
1664
|
-
hideActionsUserSeparator: false
|
|
1665
|
-
}}
|
|
1666
1496
|
smallViewportConfig={{
|
|
1667
1497
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1668
1498
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1701,9 +1531,6 @@ type: example
|
|
|
1701
1531
|
{() => (
|
|
1702
1532
|
<TopNavBar.Layout
|
|
1703
1533
|
navLabel="Example navigation bar"
|
|
1704
|
-
desktopConfig={{
|
|
1705
|
-
hideActionsUserSeparator: false
|
|
1706
|
-
}}
|
|
1707
1534
|
smallViewportConfig={{
|
|
1708
1535
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1709
1536
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1743,9 +1570,6 @@ type: example
|
|
|
1743
1570
|
{() => (
|
|
1744
1571
|
<TopNavBar.Layout
|
|
1745
1572
|
navLabel="Example navigation bar"
|
|
1746
|
-
desktopConfig={{
|
|
1747
|
-
hideActionsUserSeparator: false
|
|
1748
|
-
}}
|
|
1749
1573
|
smallViewportConfig={{
|
|
1750
1574
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
1751
1575
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -1844,9 +1668,6 @@ class LayoutExample extends React.Component {
|
|
|
1844
1668
|
navLabel={this.state.isSecondaryNavigation
|
|
1845
1669
|
? 'Example secondary navigation bar'
|
|
1846
1670
|
: 'Example navigation bar'}
|
|
1847
|
-
desktopConfig={{
|
|
1848
|
-
hideActionsUserSeparator: true
|
|
1849
|
-
}}
|
|
1850
1671
|
smallViewportConfig={{
|
|
1851
1672
|
trayMountNode: () => document.getElementById('menuMountNode'),
|
|
1852
1673
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
@@ -1859,35 +1680,6 @@ class LayoutExample extends React.Component {
|
|
|
1859
1680
|
renderBrand={
|
|
1860
1681
|
<TopNavBar.Brand
|
|
1861
1682
|
screenReaderLabel="Brand name"
|
|
1862
|
-
renderName={(
|
|
1863
|
-
<View as="div" minWidth="7rem">
|
|
1864
|
-
<Text
|
|
1865
|
-
as="div"
|
|
1866
|
-
color={inverseColor
|
|
1867
|
-
? "brand"
|
|
1868
|
-
: "primary-inverse"
|
|
1869
|
-
}
|
|
1870
|
-
transform="uppercase"
|
|
1871
|
-
size="small"
|
|
1872
|
-
weight="bold"
|
|
1873
|
-
lineHeight="condensed"
|
|
1874
|
-
>
|
|
1875
|
-
Brand
|
|
1876
|
-
</Text>
|
|
1877
|
-
<Text
|
|
1878
|
-
as="div"
|
|
1879
|
-
color={inverseColor
|
|
1880
|
-
? "primary"
|
|
1881
|
-
: "primary-inverse"
|
|
1882
|
-
}
|
|
1883
|
-
size="large"
|
|
1884
|
-
weight="normal"
|
|
1885
|
-
lineHeight="condensed"
|
|
1886
|
-
>
|
|
1887
|
-
Sub-brand
|
|
1888
|
-
</Text>
|
|
1889
|
-
</View>
|
|
1890
|
-
)}
|
|
1891
1683
|
renderIcon={inverseColor ? undefined : (
|
|
1892
1684
|
<IconBoldLine
|
|
1893
1685
|
size="small"
|
|
@@ -2184,9 +1976,6 @@ type: example
|
|
|
2184
1976
|
{() => (
|
|
2185
1977
|
<TopNavBar.Layout
|
|
2186
1978
|
navLabel="Example navigation bar"
|
|
2187
|
-
desktopConfig={{
|
|
2188
|
-
hideActionsUserSeparator: false
|
|
2189
|
-
}}
|
|
2190
1979
|
smallViewportConfig={{
|
|
2191
1980
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
2192
1981
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -2325,9 +2114,6 @@ class InPlaceDialogExample extends React.Component {
|
|
|
2325
2114
|
{({ currentLayout }) => (
|
|
2326
2115
|
<TopNavBar.Layout
|
|
2327
2116
|
navLabel="Example navigation bar"
|
|
2328
|
-
desktopConfig={{
|
|
2329
|
-
hideActionsUserSeparator: false
|
|
2330
|
-
}}
|
|
2331
2117
|
smallViewportConfig={{
|
|
2332
2118
|
dropdownMenuToggleButtonLabel: 'Toggle Menu',
|
|
2333
2119
|
dropdownMenuLabel: 'Main Menu',
|
|
@@ -2445,41 +2231,9 @@ type: example
|
|
|
2445
2231
|
navLabel={true
|
|
2446
2232
|
? 'Example secondary navigation bar'
|
|
2447
2233
|
: 'Example navigation bar'}
|
|
2448
|
-
desktopConfig={{
|
|
2449
|
-
hideActionsUserSeparator: true
|
|
2450
|
-
}}
|
|
2451
2234
|
renderBrand={
|
|
2452
2235
|
<TopNavBar.Brand
|
|
2453
2236
|
screenReaderLabel="Brand name"
|
|
2454
|
-
renderName={(
|
|
2455
|
-
<View as="div" minWidth="7rem">
|
|
2456
|
-
<Text
|
|
2457
|
-
as="div"
|
|
2458
|
-
color={inverseColor
|
|
2459
|
-
? "brand"
|
|
2460
|
-
: "primary-inverse"
|
|
2461
|
-
}
|
|
2462
|
-
transform="uppercase"
|
|
2463
|
-
size="small"
|
|
2464
|
-
weight="bold"
|
|
2465
|
-
lineHeight="condensed"
|
|
2466
|
-
>
|
|
2467
|
-
Brand
|
|
2468
|
-
</Text>
|
|
2469
|
-
<Text
|
|
2470
|
-
as="div"
|
|
2471
|
-
color={inverseColor
|
|
2472
|
-
? "primary"
|
|
2473
|
-
: "primary-inverse"
|
|
2474
|
-
}
|
|
2475
|
-
size="large"
|
|
2476
|
-
weight="normal"
|
|
2477
|
-
lineHeight="condensed"
|
|
2478
|
-
>
|
|
2479
|
-
Sub-brand
|
|
2480
|
-
</Text>
|
|
2481
|
-
</View>
|
|
2482
|
-
)}
|
|
2483
2237
|
renderIcon={inverseColor ? undefined : (
|
|
2484
2238
|
<IconBoldLine
|
|
2485
2239
|
size="small"
|
|
@@ -32,9 +32,6 @@ export const TopNavBarBrandLocator = locator(TopNavBarBrand.selector, {
|
|
|
32
32
|
findContainer: (...args: any[]) => {
|
|
33
33
|
return find('[class$="-topNavBarBrand__container"]', ...args)
|
|
34
34
|
},
|
|
35
|
-
findBrandNameContainer: (...args: any[]) => {
|
|
36
|
-
return find('[class$="-topNavBarBrand__nameContainer"]', ...args)
|
|
37
|
-
},
|
|
38
35
|
findBrandIconContainer: (...args: any[]) => {
|
|
39
36
|
return find('[class$="-topNavBarBrand__iconContainer"]', ...args)
|
|
40
37
|
},
|
|
@@ -25,11 +25,7 @@
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import React, { Component } from 'react'
|
|
27
27
|
|
|
28
|
-
import {
|
|
29
|
-
deprecated,
|
|
30
|
-
getElementType,
|
|
31
|
-
omitProps
|
|
32
|
-
} from '@instructure/ui-react-utils'
|
|
28
|
+
import { getElementType, omitProps } from '@instructure/ui-react-utils'
|
|
33
29
|
import { testable } from '@instructure/ui-testable'
|
|
34
30
|
|
|
35
31
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
@@ -54,11 +50,6 @@ id: TopNavBar.Brand
|
|
|
54
50
|
**/
|
|
55
51
|
@withStyle(generateStyle, generateComponentTheme)
|
|
56
52
|
@testable()
|
|
57
|
-
@deprecated(
|
|
58
|
-
'9',
|
|
59
|
-
{ renderName: true },
|
|
60
|
-
'Please use the updated TopNavBar design.'
|
|
61
|
-
)
|
|
62
53
|
class TopNavBarBrand extends Component<TopNavBarBrandProps> {
|
|
63
54
|
static readonly componentId = 'TopNavBar.Brand'
|
|
64
55
|
// TODO: add to the docs: making it static on parent and jsdocs parent/module settings, dont export child on its own
|
|
@@ -83,6 +74,20 @@ class TopNavBarBrand extends Component<TopNavBarBrandProps> {
|
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
componentDidMount() {
|
|
77
|
+
// TODO: Remove this in v10!
|
|
78
|
+
if ('renderName' in this.props) {
|
|
79
|
+
console.error(
|
|
80
|
+
'Warning: `renderName` prop on [TopNavBar.Brand] is deprecated, please remove it from your code. Further info: https://instructure.design/#v9-upgrade-guide/#deprecated-properties'
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// TODO: Remove this in v10!
|
|
85
|
+
if ('nameBackground' in this.props) {
|
|
86
|
+
console.error(
|
|
87
|
+
'Warning: `nameBackground` prop on [TopNavBar.Brand] is deprecated, please remove it from your code. Further info: https://instructure.design/#v9-upgrade-guide/#deprecated-properties'
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
86
91
|
this.props.makeStyles?.(this.makeStylesVariables)
|
|
87
92
|
}
|
|
88
93
|
|
|
@@ -97,14 +102,13 @@ class TopNavBarBrand extends Component<TopNavBarBrandProps> {
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
render() {
|
|
100
|
-
const { screenReaderLabel,
|
|
101
|
-
this.props
|
|
105
|
+
const { screenReaderLabel, renderIcon, href, onClick, styles } = this.props
|
|
102
106
|
|
|
103
107
|
const ElementType = getElementType(TopNavBarBrand, this.props)
|
|
104
108
|
|
|
105
109
|
return (
|
|
106
110
|
<div ref={this.handleRef} css={styles?.topNavBarBrand}>
|
|
107
|
-
{
|
|
111
|
+
{renderIcon && (
|
|
108
112
|
<View
|
|
109
113
|
{...omitProps(this.props, allowedProps)}
|
|
110
114
|
css={styles?.container}
|
|
@@ -127,15 +131,6 @@ class TopNavBarBrand extends Component<TopNavBarBrandProps> {
|
|
|
127
131
|
{renderIcon}
|
|
128
132
|
</div>
|
|
129
133
|
)}
|
|
130
|
-
{renderName && (
|
|
131
|
-
<div
|
|
132
|
-
css={styles?.nameContainer}
|
|
133
|
-
role="presentation"
|
|
134
|
-
aria-hidden="true"
|
|
135
|
-
>
|
|
136
|
-
{renderName}
|
|
137
|
-
</div>
|
|
138
|
-
)}
|
|
139
134
|
</View>
|
|
140
135
|
)}
|
|
141
136
|
</div>
|
|
@@ -46,23 +46,12 @@ type TopNavBarBrandOwnProps = {
|
|
|
46
46
|
*/
|
|
47
47
|
screenReaderLabel: string
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* The app/product/brand/company/etc. name.
|
|
51
|
-
*/
|
|
52
|
-
renderName?: React.ReactNode
|
|
53
|
-
|
|
54
49
|
/**
|
|
55
50
|
* The app/product/brand/company/etc. logo or icon.
|
|
56
51
|
* The icon is not displayed in "smallViewport" mode.
|
|
57
52
|
*/
|
|
58
53
|
renderIcon?: React.ReactNode
|
|
59
54
|
|
|
60
|
-
/**
|
|
61
|
-
* Background color of the brand name.
|
|
62
|
-
* The background is not displayed in "smallViewport" mode.
|
|
63
|
-
*/
|
|
64
|
-
nameBackground?: string
|
|
65
|
-
|
|
66
55
|
/**
|
|
67
56
|
* Background color of the icon, usually the brand color (when an icon is provided).
|
|
68
57
|
* The background is not displayed in "smallViewport" mode.
|
|
@@ -99,12 +88,7 @@ type TopNavBarBrandProps = TopNavBarBrandOwnProps &
|
|
|
99
88
|
OtherHTMLAttributes<TopNavBarBrandOwnProps>
|
|
100
89
|
|
|
101
90
|
type TopNavBarBrandStyle = ComponentStyle<
|
|
102
|
-
| '
|
|
103
|
-
| 'container'
|
|
104
|
-
| 'nameContainer'
|
|
105
|
-
| 'name'
|
|
106
|
-
| 'iconContainer'
|
|
107
|
-
| 'icon'
|
|
91
|
+
'topNavBarBrand' | 'container' | 'name' | 'iconContainer' | 'icon'
|
|
108
92
|
> &
|
|
109
93
|
Pick<TopNavBarBrandTheme, 'focusOutlineInset'>
|
|
110
94
|
|
|
@@ -114,9 +98,7 @@ type TopNavBarBrandStyleProps = {
|
|
|
114
98
|
|
|
115
99
|
const propTypes: PropValidators<PropKeys> = {
|
|
116
100
|
screenReaderLabel: PropTypes.string.isRequired,
|
|
117
|
-
renderName: PropTypes.node,
|
|
118
101
|
renderIcon: PropTypes.node,
|
|
119
|
-
nameBackground: PropTypes.string,
|
|
120
102
|
iconBackground: PropTypes.string,
|
|
121
103
|
href: PropTypes.string,
|
|
122
104
|
onClick: PropTypes.func,
|
|
@@ -126,9 +108,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
126
108
|
|
|
127
109
|
const allowedProps: AllowedPropKeys = [
|
|
128
110
|
'screenReaderLabel',
|
|
129
|
-
'renderName',
|
|
130
111
|
'renderIcon',
|
|
131
|
-
'nameBackground',
|
|
132
112
|
'iconBackground',
|
|
133
113
|
'href',
|
|
134
114
|
'onClick',
|
|
@@ -44,7 +44,7 @@ const generateStyle = (
|
|
|
44
44
|
props: TopNavBarBrandProps,
|
|
45
45
|
state: TopNavBarBrandStyleProps
|
|
46
46
|
): TopNavBarBrandStyle => {
|
|
47
|
-
const {
|
|
47
|
+
const { iconBackground } = props
|
|
48
48
|
const isDesktop = state.layout === 'desktop'
|
|
49
49
|
|
|
50
50
|
return {
|
|
@@ -65,15 +65,6 @@ const generateStyle = (
|
|
|
65
65
|
appearance: 'none',
|
|
66
66
|
textDecoration: 'none'
|
|
67
67
|
},
|
|
68
|
-
nameContainer: {
|
|
69
|
-
label: 'topNavBarBrand__nameContainer',
|
|
70
|
-
display: 'flex',
|
|
71
|
-
justifyContent: 'center',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
pointerEvents: 'none',
|
|
74
|
-
padding: componentTheme.logoPadding,
|
|
75
|
-
background: isDesktop ? nameBackground : undefined
|
|
76
|
-
},
|
|
77
68
|
name: {
|
|
78
69
|
label: 'topNavBarBrand__name',
|
|
79
70
|
display: 'flex',
|