diff --git a/src/components/ec-navigation-link/__snapshots__/ec-navigation-link.spec.ts.snap b/src/components/ec-navigation-link/__snapshots__/ec-navigation-link.spec.ts.snap index 9973800da..7fb485c0c 100644 --- a/src/components/ec-navigation-link/__snapshots__/ec-navigation-link.spec.ts.snap +++ b/src/components/ec-navigation-link/__snapshots__/ec-navigation-link.spec.ts.snap @@ -96,6 +96,38 @@ exports[`EcNavigationLink > as regular anchor > should be expanded by default 1` `; +exports[`EcNavigationLink > as regular anchor > should be use light styles when isInLightMode is passed into 1`] = ` + + + + + + + Link + + + +`; + exports[`EcNavigationLink > as regular anchor > should hide the text when is collapsed 1`] = ` as router-link > should be expanded by default 1`] = `; +exports[`EcNavigationLink > as router-link > should be use light styles when isInLightMode is passed into 1`] = ` + + + + + + + + Link + + + + +`; + exports[`EcNavigationLink > as router-link > should hide the text when is collapsed 1`] = ` { expect(wrapper.findByDataTest('ec-navigation-link').classes('ec-navigation-link--is-compact')).toBe(true); }); + it('should be use light styles when isInLightMode is passed into', () => { + const wrapper = mountAsRouterLink({ isInLightMode: true }); + expect(wrapper.element).toMatchSnapshot(); + expect(wrapper.findByDataTest('ec-navigation-link').classes('ec-navigation-link--light-mode')).toBe(true); + }); + it('should pass listeners from parent to the root', () => { const clickSpy = vi.fn(); const wrapper = mountAsRouterLink({}, { @@ -127,6 +133,12 @@ describe('EcNavigationLink', () => { expect(wrapper.findByDataTest('ec-navigation-link').classes('ec-navigation-link--is-compact')).toBe(true); }); + it('should be use light styles when isInLightMode is passed into', () => { + const wrapper = mountAsAnchor({ isInLightMode: true }); + expect(wrapper.element).toMatchSnapshot(); + expect(wrapper.findByDataTest('ec-navigation-link').classes('ec-navigation-link--light-mode')).toBe(true); + }); + it('should pass listeners from parent to the root', () => { const clickSpy = vi.fn(); const wrapper = mountAsAnchor({}, { diff --git a/src/components/ec-navigation-link/ec-navigation-link.story.ts b/src/components/ec-navigation-link/ec-navigation-link.story.ts index 1e311d0d1..98f317008 100644 --- a/src/components/ec-navigation-link/ec-navigation-link.story.ts +++ b/src/components/ec-navigation-link/ec-navigation-link.story.ts @@ -35,3 +35,21 @@ basic.args = { basic.parameters = { backgrounds: { default: DARK_THEME.name, values: [DARK_THEME] }, }; + +export const lightMode: StoryFn = args => ({ + components: { EcNavigationLink }, + setup() { + return { args }; + }, + template: ` + + `, +}); + +lightMode.args = { + text: 'Trade Finance', + iconName: IconName.SIMPLE_TRADE_FINANCE, + iconSize: 30, + url: '/trade-finance', + isInLightMode: true, +}; diff --git a/src/components/ec-navigation-link/ec-navigation-link.vue b/src/components/ec-navigation-link/ec-navigation-link.vue index 2d5280f3c..d15d49d77 100644 --- a/src/components/ec-navigation-link/ec-navigation-link.vue +++ b/src/components/ec-navigation-link/ec-navigation-link.vue @@ -12,6 +12,7 @@ 'ec-navigation-link--is-active': isActive, 'ec-navigation-link--is-compact': isCompact, 'ec-navigation-link--is-collapsed': isCollapsed, + 'ec-navigation-link--light-mode': isInLightMode, }" :to="url" > @@ -43,6 +44,7 @@ 'ec-navigation-link--is-active': isActive, 'ec-navigation-link--is-compact': isCompact, 'ec-navigation-link--is-collapsed': isCollapsed, + 'ec-navigation-link--light-mode': isInLightMode, }" :href="url" :target="target" @@ -108,6 +110,14 @@ withDefaults(defineProps(), { @apply tw-py-12 tw-px-28; } + &--light-mode { + @apply tw-text-gray-3; + + &:hover { + @apply tw-text-gray-2; + } + } + &__icon { @apply tw-fill-current; @apply tw-flex-shrink-0; diff --git a/src/components/ec-navigation-link/types.ts b/src/components/ec-navigation-link/types.ts index efb823ed6..eef147609 100644 --- a/src/components/ec-navigation-link/types.ts +++ b/src/components/ec-navigation-link/types.ts @@ -12,4 +12,5 @@ export interface NavigationLinkProps { isCollapsed?: boolean, isCompact?: boolean, target?: string, + isInLightMode?: boolean, } diff --git a/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__chrome.snap.png b/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__chrome.snap.png new file mode 100644 index 000000000..a1bd1cc90 Binary files /dev/null and b/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__chrome.snap.png differ diff --git a/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__firefox.snap.png b/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__firefox.snap.png new file mode 100644 index 000000000..5cd1583a9 Binary files /dev/null and b/tests/integration/snapshots/visual-regression.spec.js/layout-container--with-responsive-layout__firefox.snap.png differ diff --git a/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__chrome.snap.png b/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__chrome.snap.png new file mode 100644 index 000000000..016d3e868 Binary files /dev/null and b/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__chrome.snap.png differ diff --git a/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__firefox.snap.png b/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__firefox.snap.png new file mode 100644 index 000000000..26730613f Binary files /dev/null and b/tests/integration/snapshots/visual-regression.spec.js/layout-navigation-link--light-mode__firefox.snap.png differ