Skip to content

Commit

Permalink
Pickup
Browse files Browse the repository at this point in the history
  • Loading branch information
leanormandon committed May 20, 2024
1 parent 0eee25d commit abd4090
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 6 deletions.
10 changes: 5 additions & 5 deletions assets/images/chronopost.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions assets/images/mondialRelay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/Organisms/Card/Address/AddressCard.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const address = {
};

export const Base = {
render: (args) => `<div class='w-[309px]'>${AddressCard(args)}</div>`,
render: (args) => `<div class='max-w-[309px]'>${AddressCard(args)}</div>`,
play: () => {
addressCard();
},
Expand Down
12 changes: 12 additions & 0 deletions components/Organisms/Card/PickupPoint/PickupPoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export function pickupPoint() {
const buttons = document.querySelectorAll('.PickupPoint-hours');

buttons.forEach((button) => {
button.addEventListener('click', function () {
const parent = this.closest(".PickupPoint");
const hoursListing = parent.querySelector('.PickupPoint-hoursListing');
hoursListing.classList.toggle("md:hidden");
});
});
}
43 changes: 43 additions & 0 deletions components/Organisms/Card/PickupPoint/PickupPoint.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import PickupPoint from './PickupPoint.twig';
import { pickupPoint } from './PickupPoint';

export default {
title: 'Design System/Organisms/Card/PickupPoint'
};

const address = {
address1: "Adresse première ligne",
address2: "Complément d’adresse",
zipCode: '00000',
city: 'Clermont-Ferrand',
country: 'Ville-Sur-Fleuve'
};
const hours = [
{day: 'lundi', hours: '14h - 19h'},
{day: 'mardi', hours: '14h - 20h'},
{day: 'Mercredi', hours: '14h - 20h'},
{day: 'Jeudi', hours: '14h - 20h'},
{day: 'Vendredi', hours: '14h - 20h'},
{day: 'Samedi', hours: '14h - 20h'},
{day: 'Dimanche', hours: 'Fermé'},
]

export const Base = {
render: (args) => `<div class='max-w-[340px]'>${PickupPoint(args)}</div>`,
play: () => {
pickupPoint();
},
args: {
selected: false,
closed: false,
title: 'Nom du point relais',
date: 'JJ/MM',
address: address,
price: '7,80€',
img: {alt: 'Logo Mondial Relay', src: "/images/mondialRelay.svg"},
hours
},
argTypes: {
date: {control: { type: 'text' }}
}
};
36 changes: 36 additions & 0 deletions components/Organisms/Card/PickupPoint/PickupPoint.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div class='PickupPoint {% if selected %}selected{% endif %}'>
<label class='PickupPoint-content'>
{% include '../../../Atoms/Form/Radio.twig' with {type:"span", name:"PickupPoint", value:1, checked:selected} %}

<span>
<span class='PickupPoint-title'>{{ title }}</span>
<span class='PickupPoint-description'>Livraison estimée le {{ date }}</span>
<span class='PickupPoint-opening {% if closed %}closed{% endif %}'>{% if closed %}Fermé{% else %}Ouvert{% endif %} actuellement</span>
<span class='PickupPoint-address'>
<span>{{ address.address1 }},</span>
{% if address.address2 %}<span>{{ address.address2 }},</span>{% endif %}
<span>{{ address.zipCode }} {{ address.city }}</span>
</span>

</span>
</label>
<div class='PickupPoint-bottom'>
<button class='PickupPoint-hours'>{{ source("/icons/clock.svg") }}Horaires</button>
{% if img.src %}
<img src="{{ img.src }}" alt="{{ img.alt|default('Logo Pickup') }}" loading="lazy">
{% endif %}
</div>
<div class='PickupPoint-hoursListing md:hidden'>
<table>
{% for hour in hours %}
<tr>
<td>{{ hour.day }}</td>
<td>{{ hour.hours }}</td>
</tr>
{% endfor %}
</table>
</div>
<div class='md:hidden mt-4'>
{% include '../../../Molecules/Button/Button.twig' with {text: 'Choisir ce point relais', classes:'Button--fill'} %}
</div>
</div>
103 changes: 103 additions & 0 deletions components/Organisms/Card/PickupPoint/pickupPoint.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.PickupPoint {
background: var(--theme-lightest);
border: 1px solid var(--theme-lightest);
border-radius: rem-convert(8px);
padding: rem-convert(16px);

&.selected {
background: var(--white);
border: 1px solid var(--theme-medium);
}
label {
cursor: pointer;
}
&-content {
display: flex;
align-items: flex-start;
span {
display: block;
}
> span:last-child {
flex-grow: 1;
}
.Radio {
margin-top: 4px;
margin-right: 8px;
visibility: hidden;
max-width: 0;
@screen md {
visibility: visible;
max-width: initial;
}
}
}


&-hoursListing, &-bottom {
@screen md {
margin-left: rem-convert(22px);
}
}
&-bottom {
padding-top: rem-convert(16px);
@apply paragraph-4;
font-weight: 600;
display: none;
@screen md {
display: flex;
}
justify-content: space-between;
align-items: center;
}
&-hoursListing {
margin-top: rem-convert(16px);
padding-top: rem-convert(16px);
border-top: 1px solid var(--grey-lighter);
@apply paragraph-4;
td:first-child {
padding-right: rem-convert(40px);
}
}
&-hours {
display: flex;
gap: rem-convert(6px);
align-items: center;
text-decoration: underline;
svg {
width: rem-convert(18px);
height: rem-convert(18px);
}
}
&-title {
@apply paragraph-2;
font-weight: 600;
color: var(--black);
}
&-description {
@apply paragraph-6;
font-weight: 400;
color: var(--grey);
}
&-opening, &-address {
padding-top: rem-convert(13px);
@apply paragraph-4;
font-weight: 400;
color: var(--grey-dark);
}
.PickupPoint-opening {
display: flex;
align-items: center;
&:before {
content: '';
display: inline-block;
width: rem-convert(9px);
height: rem-convert(9px);
border-radius: 999px;
background: var(--success-dark);
margin-right: rem-convert(4px);
}
&.closed:before {
background: var(--error-dark);
}
}
}
3 changes: 3 additions & 0 deletions components/Organisms/Card/Transporter/Transporter.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ export const Base = {
date: 'JJ/MM',
price: '7,80€',
img: {alt: 'Logo Chronopost', src: "/images/chronopost.svg"}
},
argTypes: {
date: {control: { type: 'text' }}
}
};

0 comments on commit abd4090

Please sign in to comment.