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(sbb-journey-summary): provide a11y footpath property #3104

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -40,6 +40,12 @@ const headerLevel: InputType = {
},
};

const a11yFootpath: InputType = {
control: {
type: 'boolean',
},
};

const now: InputType = {
control: {
type: 'date',
Expand Down Expand Up @@ -68,6 +74,7 @@ const defaultArgTypes: ArgTypes = {
'disable-animation': disableAnimation,
'round-trip': roundTrip,
'header-level': headerLevel,
'a11y-footpath': a11yFootpath,
now,
trip,
tripBack,
Expand All @@ -77,6 +84,7 @@ const defaultArgs: Args = {
'disable-animation': false,
'round-trip': false,
'header-level': headerLevel.options![2],
'a11y-footpath': false,
now: new Date('2022-12-05T12:11:00').valueOf(),
trip: undefined,
tripBack: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export class SbbJourneySummaryElement extends LitElement {
*/
@property({ attribute: 'disable-animation', type: Boolean }) public disableAnimation?: boolean;

/**
* The Footpath attribute for rendering different icons
* true: render a11y-icon
* false: render walk-icon
* default: render walk-icon
*/
@property({ attribute: 'a11y-footpath', type: Boolean }) public a11yFootpath?: boolean;

/** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */
@property()
public set now(value: SbbDateLike | undefined) {
Expand Down Expand Up @@ -138,6 +146,7 @@ export class SbbJourneySummaryElement extends LitElement {
.arrivalWalk=${arrivalWalk}
.legs=${legs}
.disableAnimation=${this.disableAnimation}
.a11yFootpath=${this.a11yFootpath}
.now=${this.now}
></sbb-pearl-chain-time>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe(`sbb-journey-summary`, () => {
trip: undefined as object | undefined,
tripBack: undefined as object | undefined,
hasSlot: true,
a11yFootpath: false,
};

const template = ({
Expand All @@ -30,12 +31,14 @@ describe(`sbb-journey-summary`, () => {
trip,
tripBack,
hasSlot,
a11yFootpath,
rfuhrmann marked this conversation as resolved.
Show resolved Hide resolved
}: typeof defaultArgs): TemplateResult => html`
<sbb-journey-summary
?round-trip=${roundTrip}
.trip=${trip}
.tripBack=${tripBack}
.now=${now}
.a11yFootpath=${a11yFootpath}
disable-animation
>
${hasSlot
Expand Down
17 changes: 9 additions & 8 deletions src/elements-experimental/journey-summary/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ This is helpful if you need a specific state of the component.

## Properties

| Name | Attribute | Privacy | Type | Default | Description |
| ------------------ | ------------------- | ------- | --------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | Per default, the current location has a pulsating animation. You can disable the animation with this property. |
| `headerLevel` | `header-level` | public | `SbbTitleLevel` | `'3'` | Heading level of the journey header element (e.g. h1-h6). |
| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. |
| `roundTrip` | `round-trip` | public | `boolean \| undefined` | | The RoundTrip prop. This prop controls if one or two arrows are displayed in the header. |
| `trip` | `trip` | public | `InterfaceSbbJourneySummaryAttributes` | | The trip prop |
| `tripBack` | `trip-back` | public | `InterfaceSbbJourneySummaryAttributes \| undefined` | | The tripBack prop |
| Name | Attribute | Privacy | Type | Default | Description |
| ------------------ | ------------------- | ------- | --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `a11yFootpath` | `a11y-footpath` | public | `boolean \| undefined` | | The Footpath attribute for rendering different icons true: render a11y-icon false: render walk-icon default: render walk-icon |
| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | Per default, the current location has a pulsating animation. You can disable the animation with this property. |
| `headerLevel` | `header-level` | public | `SbbTitleLevel` | `'3'` | Heading level of the journey header element (e.g. h1-h6). |
| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. |
| `roundTrip` | `round-trip` | public | `boolean \| undefined` | | The RoundTrip prop. This prop controls if one or two arrows are displayed in the header. |
| `trip` | `trip` | public | `InterfaceSbbJourneySummaryAttributes` | | The trip prop |
| `tripBack` | `trip-back` | public | `InterfaceSbbJourneySummaryAttributes \| undefined` | | The tripBack prop |

## Slots

Expand Down
Loading