style opening hours

This commit is contained in:
elise
2024-07-10 16:13:49 +02:00
parent 6288ffa050
commit 77a356834c
3 changed files with 57 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import {
PrettyOpeningHours, PrettyOpeningHours,
} from "@/lib/openinghours"; } from "@/lib/openinghours";
import styles from "./openingHoursSectionBlock.module.scss"; import styles from "./openingHoursSectionBlock.module.scss";
import { Fragment } from "react";
function OpeningHoursSubsection({ function OpeningHoursSubsection({
title, title,
@ -15,16 +16,20 @@ function OpeningHoursSubsection({
return ( return (
<section className={styles.openingHoursSubsection}> <section className={styles.openingHoursSubsection}>
<h3>{title}</h3> <h3>{title}</h3>
<ul> <table className="openingHours">
<tbody>
{prettyHours.map(({ range, time, custom }) => ( {prettyHours.map(({ range, time, custom }) => (
<li key={range}> <tr key={range}>
<span className={styles.dayRange}>{range}</span>:&nbsp; <td className={styles.dayRange}>{range}</td>
<td>
{time && <span className={styles.timeRange}>{time}</span>} {time && <span className={styles.timeRange}>{time}</span>}
{custom && <span className={styles.timeRange}>{custom}</span>} {custom && <span className={styles.timeRange}>{custom}</span>}
{!time && !custom && <span className={styles.closed}>Stengt</span>} {!time && !custom && <span className={styles.closed}>Stengt</span>}
</li> </td>
</tr>
))} ))}
</ul> </tbody>
</table>
</section> </section>
); );
} }

View File

@ -0,0 +1,41 @@
.openingHoursSection {
display: grid;
grid-template-columns: repeat(12, 1fr);
column-gap: var(--spacing-gap-column);
row-gap: var(--spacing-gap-row);
p {
grid-column: 2 / span 10;
}
}
.openingHoursSubsection {
grid-column: span 5;
margin: 1rem 0 0;
&:nth-of-type(odd) {
grid-column: 2 / span 5;
}
h3 {
margin-bottom: .5rem;
}
}
.dayRange {
&:first-letter {
text-transform: capitalize;
}
}
@media (max-width: 1000px) {
.openingHoursSection {
p {
grid-column: 1 / -1;
}
}
.openingHoursSubsection,
.openingHoursSubsection:nth-of-type(odd) {
grid-column: 1 / -1;
}
}

View File

@ -271,7 +271,7 @@ select {
width: 50%; width: 50%;
vertical-align: top; vertical-align: top;
line-height: 1.2; line-height: 1.2;
padding: .25em 0; padding: .2rem 0;
&:first-child { &:first-child {
padding-right: var(--spacing-s); padding-right: var(--spacing-s);