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

DDFFORM 417 #568

Merged
merged 5 commits into from
Apr 5, 2024
Merged

DDFFORM 417 #568

merged 5 commits into from
Apr 5, 2024

Conversation

LasseStaus
Copy link
Contributor

@LasseStaus LasseStaus commented Apr 3, 2024

Link to issue

Jira: DDFFORM-417

Description

This PR depends on two PRs.

React PR
CMS PR

This PR adds the markup and styling for the OpeningHours component, which is used to display the opening hours for a branch.

I have left chromatic unaccepted on purpose. Will accept once approved.

Screenshot of the result

image

Additional comments or questions

I am not sure why there are 34 UI changes.

The only changes that should be related to this pr, are the New Stories for openingHours in chromatic.

Please add comments if you have any suggestions for improvement.

This PR had a lot of refactoring after developing the React part. If you see any unused CSS or unnessecary markup mark it, although this hopefully isn't the case.

Copy link
Contributor

@kasperg kasperg left a comment

Choose a reason for hiding this comment

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

👍 I have a few things for you to consider but you can decide for yourself how/if to solve these and then merge at you please.

Comment on lines +1 to +4
// These types are based on the actual data structure returned from the API.
// The types starting with DplOpeningHours.. are generated with Orval in react
// and copy pasted here.
export type DplOpeningHoursListGET200Item = {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Appreciate the commenting here.

Normally I would not think that these "technicalities" belonged in the design system"

Comment on lines 18 to 42
<div className="opening-hours">
<div className="opening-hours__wrapper">
<div className="opening-hours__header">
<h2 className="opening-hours__heading">Åbningstider</h2>
<div className="opening-hours__navigation-controls">
<button
className="opening-hours__navigation-control"
aria-label="Previous week"
type="button"
>
<ArrowLeft />
</button>
<div className="opening-hours__week-display">
{weekCurrentlyDisplayed}
</div>
<button
className="opening-hours__navigation-control"
aria-label="Next week"
type="button"
>
<ArrowRight />
</button>
</div>
</div>
<OpeningHoursWeekList groupedOpeningHours={groupedOpeningHours} />
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider if we can drop the div className="opening-hours__wrapper"> element.

We already have a <div className="opening-hours"> element to wrap the entire component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need the layout-container for opening_hours, but the contents need to be max-width:600px. within that.

I wasn't sure whether to use a wrapper for all the content, or to add the max-width two places, in this case __header and __content.

I have changed it to the second approach now, which effectively does the same, but without the wrapper. Not sure which i like best.

Comment on lines 13 to 27
<ul className="opening-hours__content">
{groupedOpeningHours.map(({ day, date, openingHourEntries }) => {
const formattedDateForDisplay = new Date(date).toLocaleDateString(
"da-DK",
{
day: "numeric",
month: "2-digit",
}
);

return (
<li key={date} className="opening-hours__row">
<h3 className="opening-hours__individual-day">{`${day}: d. ${formattedDateForDisplay}`}</h3>
{openingHourEntries.length > 0 ? (
<ul>
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider if these lists are actually ordered (<ol> instead of <ul>).

In general I appreciate the use of list elements here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to used OL since they atleast the weeks follow an specific sequence. 👍 Will for "categories" aswell.


return (
<li key={date} className="opening-hours__row">
<h3 className="opening-hours__individual-day">{`${day}: d. ${formattedDateForDisplay}`}</h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a <time> element here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah agree 👍

line-height: 32px;
}
}
.opening-hours__individual-opening--odd {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.opening-hours__individual-opening--odd {
.opening-hours__individual-opening:nth-child(odd) {

I think this can be simplified a bit using :nth-child() like we use :first-child below.

This means we have remove the logic for applying this class also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is better 👍

Comment on lines +1 to +7
.opening-hours {
.ssc-line {
height: $s-xl;
}
.ssc-line--odd {
opacity: 0.5;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for making an effort by adding a skeleton.

Comment on lines 77 to 79
&:hover {
cursor: pointer;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider if this is necessary as these element are <buttons> already.

Copy link
Contributor Author

@LasseStaus LasseStaus Apr 4, 2024

Choose a reason for hiding this comment

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

Good catch. Wasn't cleaned up after refactor where there was a "select-ish-box" too

@kasperg kasperg assigned LasseStaus and unassigned kasperg, rasben and kasperbirch1 Apr 4, 2024
This is the main component for displaying the openinghours for a branch.

It depends on other commits for styling & sub-components.

DDFFORM-417
These are subcomponents used for displaying openinghours for a branch.

Depends on other commits for styling.

DDFFORM-417
The example data-types are copied from the react repo.

The Example data represents the grouped data after filtering in react, not the queried data.

DDFFORM-417
@LasseStaus LasseStaus merged commit 6f9a05c into release/form-sprint-10 Apr 5, 2024
8 checks passed
@LasseStaus LasseStaus deleted the DDFFORM-417 branch April 5, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants