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-pearl-chain): implement new component structure #3172

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

MarioCastigliano
Copy link
Contributor

@MarioCastigliano MarioCastigliano commented Oct 24, 2024

Preflight Checklist

Issue

This PR Closes #2335

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

See Review Guidelines for more information what is checked during review process.

Changes

Changes in this pull request:

Browsers

I tested the build on the following browsers:

  • Firefox Desktop
  • Chrome Desktop
  • Edge Desktop
  • Safari Desktop
  • Chrome Mobile
  • Safari Mobile

Screen readers

I tested the build on the following browsers:

  • JAWS Firefox Desktop
  • JAWS Chrome Desktop
  • NVDA Firefox Desktop
  • NVDA Chrome Desktop
  • VoiceOver Safari Desktop
  • VoiceOver Chrome Desktop
  • VoiceOver Safari Mobile
  • Android Accessibility Suite Chrome Mobile

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot temporarily deployed to pr3172 October 28, 2024 11:40 Inactive
@github-actions github-actions bot temporarily deployed to pr3172-diff October 28, 2024 11:40 Inactive
@github-actions github-actions bot temporarily deployed to pr3172 October 28, 2024 14:23 Inactive
@github-actions github-actions bot temporarily deployed to pr3172-diff October 28, 2024 14:24 Inactive
@MarioCastigliano MarioCastigliano added the pr: peer review required A peer review is required for this pull request label Oct 28, 2024
@MarioCastigliano MarioCastigliano self-assigned this Oct 28, 2024
Copy link
Contributor

@DavideMininni-Fincons DavideMininni-Fincons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review


## States

The `past`, `arrival-skipped`, `departure-skipped`, and `disruption` properties are connected to the self-named states.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some extra info about what happens when these params are set would be helpful (e.g. what is rendered when)

src/elements/pearl-chain/pearl-chain/readme.md Outdated Show resolved Hide resolved
src/elements/pearl-chain/pearl-chain/pearl-chain.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,107 @@
import { html } from 'lit';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forced colors tests?

@github-actions github-actions bot temporarily deployed to pr3172 October 29, 2024 17:21 Inactive
@github-actions github-actions bot temporarily deployed to pr3172-diff October 29, 2024 17:21 Inactive
@MarioCastigliano MarioCastigliano marked this pull request as ready for review October 30, 2024 10:07
@github-actions github-actions bot temporarily deployed to pr3172 October 30, 2024 10:28 Inactive
Copy link
Contributor

@jeripeierSBB jeripeierSBB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for addressing the refactoring! I have some ideas and change requests. If you don't understand something, don't hesitate to ask me :). Some ideas or comments maybe cross other comments, depending on how we proceed with an idea.

src/elements/pearl-chain/pearl-chain/pearl-chain.ts Outdated Show resolved Hide resolved
src/elements/pearl-chain/pearl-chain/pearl-chain.ts Outdated Show resolved Hide resolved
}

private _removeTimezone(time: SbbDateLike | null): Date | undefined {
const parsedDate = defaultDateAdapter.deserialize(time);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dateAdapter should be loaded from config:
private _dateAdapter: DateAdapter<T> = readConfig().datetime?.dateAdapter ?? defaultDateAdapter;
(every defaultDateAdapter should be replaced with that) could also have influence of other date calculations

src/elements/pearl-chain/pearl-chain/pearl-chain.ts Outdated Show resolved Hide resolved
src/elements/pearl-chain/pearl-chain/pearl-chain.ts Outdated Show resolved Hide resolved
height: var(--sbb-pearl-chain-height);
border-inline-end: var(--sbb-pearl-chain-last-leg-margin, var(--sbb-pearl-chain-spacing-small))
solid Canvas;
background-color: currentcolor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic question: why do you define color and then define background with currentcolor? as there is no text at all in this component, couldn't we directly style the background?


@mixin sbb-pearl-chain-dotted {
background-color: unset;
background-image: linear-gradient(to right, currentcolor 0%, currentcolor 50%, Canvas 50%);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove all Canvas or white background usages and replace them with another approach? I know it's not that easy, but I guess it should be possible. (e.g. with mask-image and linear gradient).

Using Canvas prints a white background:
Bildschirmfoto 2024-11-13 um 14 28 50

content: '';
position: absolute;
inset-block-start: -200%;
z-index: 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as other comments, refactoring without z-index possible?


import './pearl-chain-leg.js';

describe('sbb-pearl-chain-leg', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also test combinations of props? like past and disruption and so on... so we ensure everyhing looks like expected.


import './pearl-chain-leg.js';

describe('sbb-pearl-chain-leg', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to share the template either with cases and describeEach, or just a beforEach(). now e.g. every departure and arrival time is the same (times don't affect rendering right now)

@jeripeierSBB jeripeierSBB changed the title refactor(pearl-chain): implement new component structure feat(pearl-chain): implement new component structure Nov 13, 2024
@jeripeierSBB jeripeierSBB changed the title feat(pearl-chain): implement new component structure feat(sbb-pearl-chain): implement new component structure Nov 13, 2024
@TomMenga TomMenga added the pr: lead review required A lead review is required for this pull request label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: lead review required A lead review is required for this pull request pr: peer review required A peer review is required for this pull request pr: visual review required target: 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

story(sbb-pearl-chain): Refactor initial implementation
4 participants