Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(masthead): spacing style regression fix and maintainability refactor #11252

Merged
merged 33 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e7c6006
feat(masthead): deprecate navLinks props in favor of l0Data
jkaeser Dec 19, 2023
5e02805
fix(masthead): make required spacing Sass functions available
jkaeser Dec 19, 2023
a8beb0c
chore(masthead): remove references to outdated data structures
jkaeser Dec 19, 2023
a18bdf7
feat(masthead): split rendering into discrete methods
jkaeser Dec 19, 2023
4d38dfa
feat(masthead): untangle left and top nav rendering
jkaeser Dec 19, 2023
010df96
fix(masthead): remove unused import
jkaeser Dec 19, 2023
50d9d58
feat(masthead): add consistency to render method doc blocks
jkaeser Dec 19, 2023
2e6a30c
feat(masthead): remove cloud-specific masthead
jkaeser Dec 19, 2023
0174016
feat(services-store): remove outdated translateAPI types
jkaeser Dec 19, 2023
d7ecc70
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Dec 20, 2023
5ce6506
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Dec 21, 2023
e25ea11
feat(masthead): remove leftover cloud masthead references
jkaeser Dec 21, 2023
40f1515
feat(masthead): fix imports
jkaeser Dec 21, 2023
e651830
feat(masthead): provide descriptions for returned values
jkaeser Dec 22, 2023
e576ed3
feat(masthead): remove lingering Cloud reference
jkaeser Jan 2, 2024
2e232d8
feat(masthead): deprecate data shapes in favor of better organization
jkaeser Jan 2, 2024
0dc8abc
feat(masthead): remove CTA functionality
jkaeser Jan 2, 2024
05c27e3
feat(masthead): remove Cloud story
jkaeser Jan 2, 2024
1fd5b1d
feat(masthead): remove CTA references from Translation type
jkaeser Jan 2, 2024
cb4722a
feat(dotcom-shell): update story's masthead data import
jkaeser Jan 2, 2024
758f9c8
feat(masthead): update test snapshots
jkaeser Jan 2, 2024
45129ad
feat(masthead): use updated prefixes in tests
jkaeser Jan 3, 2024
20656ed
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Jan 3, 2024
d0d912f
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Jan 4, 2024
9923bb4
fix(masthead): do not assume l0 data is present
jkaeser Jan 4, 2024
7b096ac
fix(masthead): do not assume menu items are present
jkaeser Jan 4, 2024
25169b6
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Jan 8, 2024
107e893
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Jan 9, 2024
c77ba78
Merge branch 'main' into feat/masthead-v2-cleanup
kennylam Jan 9, 2024
6efec36
feat(masthead): render search
jkaeser Jan 9, 2024
f3e6144
Merge branch 'main' into feat/masthead-v2-cleanup
kodiakhq[bot] Jan 11, 2024
93aed8b
chore(masthead): update v2 documentation (#11239)
jkaeser Jan 11, 2024
9864980
Merge branch 'main' into feat/masthead-v2-cleanup
jkaeser Jan 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ const mockTranslation: Partial<Translation> = {
},
{
title: 'menu-title-foo',
menuSections: [
submenu: [
{
menuItems: [
{
title: 'menu-item-title-bar',
url: 'https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/web-components/bar',
},
],
title: 'menu-item-title-bar',
url: 'https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/web-components/bar',
},
],
},
Expand All @@ -54,7 +50,7 @@ const mockTranslation: Partial<Translation> = {
};

const endpoint =
'/common/carbon-for-ibm-dotcom/translations/masthead-footer/v2';
'/common/carbon-for-ibm-dotcom/translations/masthead-footer/v2.1';

describe('Redux actions for `TranslateAPI`', () => {
it('dispatches the action to set translation data', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ const mockTranslation: Partial<Translation> = {
},
{
title: 'menu-title-foo',
menuSections: [
submenu: [
{
menuItems: [
{
title: 'menu-item-title-bar',
url: 'https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/web-components/bar',
},
],
title: 'menu-item-title-bar',
url: 'https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/web-components/bar',
},
],
},
Expand Down
137 changes: 41 additions & 96 deletions packages/services-store/src/types/translateAPI.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2020, 2023
* Copyright IBM Corp. 2020, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -29,69 +29,29 @@ export interface BasicLinkSet {
links: BasicLink[];
}

/**
* A feature in mega panel.
*/
export interface MegapanelFeature {
heading?: string;
imageUrl?: string;
linkTitle?: string;
linkUrl?: string;
}

/**
* A content in mega panel.
*/
export interface MegapanelContent {
headingTitle?: string;
headingUrl?: string;
description?: string;
quickLinks: BasicLinkSet;
feature: MegapanelFeature;
export interface L0Menu {
items: L0MenuItem[];
}

/**
* A menu item in masthead.
*/
export interface MastheadMenuItem {
title: string;
titleEnglish?: string;
url?: string;
highlighted?: boolean;
megaPanelViewAll?: boolean;
megapanelContent?: MegapanelContent;
export interface L0MenuItem extends BasicLink {
submenu?: L0Megamenu | BasicLink[];
}

/**
* A menu section in masthead.
*/
export interface MastheadMenuSection {
heading?: string;
menuItems: MastheadMenuItem[];
export interface L0Megamenu {
sections: Megapanel[];
highlights?: MegapanelLinkGroup[];
viewAll?: BasicLink;
}

/**
* An item in masthead.
*/
export interface MastheadLink {
title: string;
titleEnglish?: string;
url?: string;
hasMenu?: boolean;
hasMegapanel?: boolean;
megamenuLayout?: 'tab' | 'list';
menuSections?: MastheadMenuSection[];
export interface Megapanel {
heading?: BasicLink;
groups: MegapanelLinkGroup[];
viewAll?: BasicLink;
}

/**
* A menu section for masthead
*
* @deprecated
*/
export interface LegacyMastheadL1 {
title: string;
url?: string;
menuItems?: MastheadLink[];
export interface MegapanelLinkGroup {
heading?: BasicLink;
links?: BasicLink[];
}

/**
Expand Down Expand Up @@ -176,12 +136,13 @@ export interface MastheadLogoData {

/**
* Cloud Masthead Profile content
*
* @deprecated
*/
export interface MastheadProfileContent {
iconLabel: string;
links: MastheadProfileItem[];
ctaButtons: MastheadProfileItem[];
contactUsButton: string;
}

/**
Expand All @@ -194,11 +155,16 @@ export interface MiscLabels {
* The translation data for ibm.com sites
*/
export interface Translation {
/**
* Main masthead navigation data.
*
* @deprecated Use masthead.nav instead.
*/
mastheadNav: {
/**
* The nav links.
*/
links: MastheadLink[];
links: L0MenuItem[];
};

/**
Expand All @@ -211,8 +177,25 @@ export interface Translation {
*/
footerThin: BasicLink[];

/**
* Masthead items other than main navigation
*/
masthead: {
logo: MastheadLogoData;
nav: L0MenuItem[];
contact: MastheadProfileItem;
profileMenu: {
unauthenticated: MastheadProfileItem[];
authenticated: MastheadProfileItem[];
signedin: MastheadProfileContent;
signedout: MastheadProfileContent;
};
};

/**
* The profile menus.
*
* @deprecated Use masthead.profileMenu instead.
*/
profileMenu: {
/**
Expand All @@ -226,18 +209,6 @@ export interface Translation {
signedout: MastheadProfileItem[];
};

/**
* Cloud masthead items
*/
masthead: {
logo: MastheadLogoData;
contact: MastheadProfileContent;
profileMenu: {
signedout: MastheadProfileContent;
signedin: MastheadProfileContent;
};
};

/**
* Miscellaneous translations
*/
Expand Down Expand Up @@ -296,29 +267,3 @@ export interface TranslateAPIState {
*/
errorsRequestTranslation?: { [language: string]: Error };
}

// New for v2.1.0
export interface L0Menu {
items: L0MenuItem[];
}

export interface L0MenuItem extends BasicLink {
submenu?: L0Megamenu | BasicLink[];
}

export interface L0Megamenu {
sections: Megapanel[];
highlights?: MegapanelLinkGroup[];
viewAll?: BasicLink;
}

export interface Megapanel {
heading?: BasicLink;
groups: MegapanelLinkGroup[];
viewAll?: BasicLink;
}

export interface MegapanelLinkGroup {
heading?: BasicLink;
links?: BasicLink[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@use '@carbon/styles/scss/themes' as *;
@use '@carbon/styles/scss/type' as *;
@use '@carbon/styles/scss/utilities' as *;
@use '@carbon/styles/scss/utilities/convert' as *;
@use '@carbon/styles/scss/components/button/tokens' as *;
@use '../../globals/vars' as *;
@use 'vars' as *;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@use '@carbon/styles/scss/theme' as *;
@use '@carbon/styles/scss/type' as *;
@use '@carbon/styles/scss/utilities' as *;
@use '@carbon/styles/scss/utilities/convert' as *;
@use '../../globals/utils/flex-grid' as *;
@use '../../globals/vars' as *;

Expand Down Expand Up @@ -78,7 +79,6 @@
.#{$prefix}--header__menu-title[aria-expanded='false']
+ .#{$prefix}--header__menu {
::slotted(#{$c4d-prefix}-megamenu),
::slotted(#{$c4d-prefix}-cloud-megamenu),
.#{$prefix}--masthead__megamenu {
animation: $transition-expansion motion(standard, expressive) collapse;
}
Expand All @@ -99,7 +99,6 @@
visibility: visible;

::slotted(#{$c4d-prefix}-megamenu),
::slotted(#{$c4d-prefix}-cloud-megamenu),
.#{$prefix}--masthead__megamenu {
animation: $transition-expansion motion(standard, expressive) expand;
}
Expand All @@ -121,7 +120,6 @@
}

:host(#{$c4d-prefix}-megamenu),
:host(#{$c4d-prefix}-cloud-megamenu),
.#{$prefix}--masthead__megamenu {
@include box-shadow;
--#{$c4d-prefix}-masthead-max-height: calc(
Expand Down
7 changes: 5 additions & 2 deletions packages/styles/scss/components/masthead/_masthead.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
@use '@carbon/styles/scss/theme' as *;
@use '@carbon/styles/scss/themes' as *;
@use '@carbon/styles/scss/type' as *;
@use '@carbon/styles/scss/layout' as layout;
@use '@carbon/styles/scss/utilities' as *;
@use '@carbon/styles/scss/utilities/convert' as *;
@use '../../globals/vars' as *;
@use '../link-with-icon';
@use 'vars' as *;
Expand Down Expand Up @@ -266,8 +268,9 @@
}

:host(#{$c4d-prefix}-masthead-composite),
:host(#{$c4d-prefix}-masthead-container),
:host(#{$c4d-prefix}-cloud-masthead-container) {
:host(#{$c4d-prefix}-masthead-container) {
@include layout.emit-layout-tokens();

position: relative;
z-index: 900;
display: block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2023
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down
1 change: 0 additions & 1 deletion packages/web-components/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ KALTURA_UICONF_ID=<Kaltura uiconf id, e.g. 12905712>

# Feature Flags
C4D_FLAGS_ALL=<Boolean flag to turn on all feature flags>
C4D_CLOUD_MASTHEAD=<Boolean flag to turn on/off cloud masthead>

This file was deleted.

This file was deleted.

Loading
Loading