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

[component]: Language switch #3633

Open
3 of 8 tasks
Tracked by #3637
gfellerph opened this issue Oct 3, 2024 · 2 comments · May be fixed by #4044
Open
3 of 8 tasks
Tracked by #3637

[component]: Language switch #3633

gfellerph opened this issue Oct 3, 2024 · 2 comments · May be fixed by #4044
Assignees
Labels
📦 components Related to the @swisspost/design-system-components package

Comments

@gfellerph
Copy link
Member

gfellerph commented Oct 3, 2024

Create a standalone language switch component. The current implementation (https://github.com/swisspost/design-system/tree/main/packages/internet-header/src/components/post-language-switch) relies on a config file, the new component should be usable without that configuration.

Design

https://www.figma.com/design/JIT5AdGYqv6bDRpfBPV8XR/Foundations-%26-Components-Next-Level?node-id=2908-30439&t=saHtog1amMMrG60S-4

image image

Props

  • caption: A title for the list, e.g. "Sprachnavigation"
  • description: A descriptive text, e.g. "Die ausgewählte Sprache ist Deutsch"
  • variant: list (default)|dropdown determines the rendering of the language switch either as a list (used on mobile in the header) or a dropdown (used on desktop in the header)
  • mode: link (default)|events determines if the language-switch navigates to a different page or just emits events

Slots

  • post-language-option: Used for displaying the available options

Requirements

  • Responsive: The language switch should be a menu dropdown on desktop and a horizontal list on mobile
  • Placement: The placement will be handled by the <post-header> component, so the language switch should expose auto-slot behaviour <post-language-switch slot="post-language-switch">

Proposed markup

List

<!-- Default with links -->
<post-language-switch variant=events title=Sprachnavigation description="Die aktuelle Sprache ist Deutsch">
  <post-language-option active lang=de title=Deutsch url="/de">DE</post-language-option>
</post-language-switch>

<!-- Event driven with buttons -->
<post-language-switch variant=events title=Sprachnavigation description="Die aktuelle Sprache ist Deutsch">
  <post-language-option active lang=de title=Deutsch>DE</post-language-option>
</post-language-switch>

<!-- Mobile rendering -->
<Host>
  <post-list>
    <h3>{this.title}, {this.description}</h3>
    <slot></slot>
  </post-list>
</Host>

<!-- Desktop rendering -->
<Host>
  <post-menu-toggle>
    <button>
      {this.title}, {this.description}
    </button>
  </post-menu-toggle>
  <post-menu>
    <post-list>
      <h3>{this.title}</h3>
      <slot></slot>
    </post-list>
  </post-menu>
</Host>

Tasks

  1. 📦 components
    alionazherdetska
  2. 5 of 5
    good first issue 📦 components
    myrta2302
  3. 3 of 3
    📦 components
    alizedebray
@gfellerph gfellerph added the 📦 components Related to the @swisspost/design-system-components package label Oct 3, 2024
@gfellerph gfellerph added this to the Cargo Components milestone Oct 3, 2024
@gfellerph
Copy link
Member Author

Component naming possibilities:

  • post-language-switch
  • post-languageswitch
  • post-i18n
  • post-language-dropdown
  • post-language-menu

@gfellerph gfellerph added the 💭 draft Issue is not ready for development label Oct 11, 2024
@gfellerph
Copy link
Member Author

Should this component be made only from <post-menu> and <post-list> with according styles from the styles package?

@gfellerph gfellerph removed 💭 draft Issue is not ready for development needs: refinement labels Oct 16, 2024
@gfellerph gfellerph moved this from 👀 Triage to 💻 Ready for development in Design System Production Board Oct 16, 2024
@myrta2302 myrta2302 assigned myrta2302 and unassigned myrta2302 Oct 24, 2024
@leagrdv leagrdv self-assigned this Nov 1, 2024
@leagrdv leagrdv moved this from 💻 Ready for development to 🕹️ Coding in progress in Design System Production Board Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 components Related to the @swisspost/design-system-components package
Projects
Status: 🤬 Dev in review
Development

Successfully merging a pull request may close this issue.

3 participants