lerelais-front-library 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/skills/project-structure/SKILL.md +51 -0
- package/.cursor/skills/storybook-react/SKILL.md +60 -0
- package/.cursor/skills/testing-react/SKILL.md +52 -0
- package/README.md +93 -0
- package/index.html +18 -0
- package/package.json +34 -0
- package/src/App.css +49 -0
- package/src/App.tsx +366 -0
- package/src/assets/icons/alert-triangle.svg +7 -0
- package/src/assets/icons/arrow-right.svg +5 -0
- package/src/assets/icons/bell.svg +6 -0
- package/src/assets/icons/chevron-down.svg +5 -0
- package/src/assets/icons/chevron-right.svg +5 -0
- package/src/assets/icons/clock-muted.svg +10 -0
- package/src/assets/icons/clock.svg +11 -0
- package/src/assets/icons/close.svg +5 -0
- package/src/assets/icons/core-camera.svg +5 -0
- package/src/assets/icons/core-check-sm.svg +5 -0
- package/src/assets/icons/core-check-white.svg +5 -0
- package/src/assets/icons/core-check.svg +5 -0
- package/src/assets/icons/core-chevron.svg +5 -0
- package/src/assets/icons/core-dot.svg +3 -0
- package/src/assets/icons/core-lock-form.svg +5 -0
- package/src/assets/icons/core-lock.svg +5 -0
- package/src/assets/icons/core-map-pin.svg +5 -0
- package/src/assets/icons/core-package-lg.svg +5 -0
- package/src/assets/icons/core-package.svg +5 -0
- package/src/assets/icons/core-pin-info.svg +6 -0
- package/src/assets/icons/core-pin-value.svg +5 -0
- package/src/assets/icons/core-pin-white.svg +5 -0
- package/src/assets/icons/core-plus.svg +5 -0
- package/src/assets/icons/core-search-dark.svg +5 -0
- package/src/assets/icons/core-search.svg +5 -0
- package/src/assets/icons/core-store.svg +9 -0
- package/src/assets/icons/core-x.svg +5 -0
- package/src/assets/icons/heart.svg +5 -0
- package/src/assets/icons/logout.svg +7 -0
- package/src/assets/icons/map-pin.svg +5 -0
- package/src/assets/icons/package-read.svg +8 -0
- package/src/assets/icons/package-white.svg +8 -0
- package/src/assets/icons/package.svg +8 -0
- package/src/assets/icons/plus.svg +6 -0
- package/src/assets/icons/settings.svg +6 -0
- package/src/assets/icons/switch-off.svg +19 -0
- package/src/assets/icons/switch-on.svg +19 -0
- package/src/assets/icons/unread-dot.svg +3 -0
- package/src/assets/icons/upload-cloud.svg +5 -0
- package/src/assets/icons/user.svg +6 -0
- package/src/assets/icons.ts +41 -0
- package/src/components/Accordion/Accordion.module.css +34 -0
- package/src/components/Accordion/Accordion.test.tsx +20 -0
- package/src/components/Accordion/Accordion.tsx +38 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/ActionCard/ActionCard.module.css +50 -0
- package/src/components/ActionCard/ActionCard.test.tsx +15 -0
- package/src/components/ActionCard/ActionCard.tsx +33 -0
- package/src/components/ActionCard/index.ts +1 -0
- package/src/components/Alert/Alert.module.css +47 -0
- package/src/components/Alert/Alert.test.tsx +14 -0
- package/src/components/Alert/Alert.tsx +27 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Avatar/Avatar.module.css +37 -0
- package/src/components/Avatar/Avatar.test.tsx +9 -0
- package/src/components/Avatar/Avatar.tsx +18 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/Badge.module.css +37 -0
- package/src/components/Badge/Badge.test.tsx +14 -0
- package/src/components/Badge/Badge.tsx +21 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/BarChart/BarChart.module.css +57 -0
- package/src/components/BarChart/BarChart.test.tsx +18 -0
- package/src/components/BarChart/BarChart.tsx +47 -0
- package/src/components/BarChart/index.ts +1 -0
- package/src/components/BenefitsCard/BenefitsCard.module.css +44 -0
- package/src/components/BenefitsCard/BenefitsCard.test.tsx +10 -0
- package/src/components/BenefitsCard/BenefitsCard.tsx +33 -0
- package/src/components/BenefitsCard/index.ts +1 -0
- package/src/components/BottomNavItem/BottomNavItem.module.css +24 -0
- package/src/components/BottomNavItem/BottomNavItem.test.tsx +20 -0
- package/src/components/BottomNavItem/BottomNavItem.tsx +23 -0
- package/src/components/BottomNavItem/index.ts +1 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +31 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +29 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +36 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Button/Button.module.css +61 -0
- package/src/components/Button/Button.test.tsx +34 -0
- package/src/components/Button/Button.tsx +24 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.module.css +53 -0
- package/src/components/Checkbox/Checkbox.test.tsx +20 -0
- package/src/components/Checkbox/Checkbox.tsx +20 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/ConfirmModal/ConfirmModal.module.css +69 -0
- package/src/components/ConfirmModal/ConfirmModal.test.tsx +25 -0
- package/src/components/ConfirmModal/ConfirmModal.tsx +50 -0
- package/src/components/ConfirmModal/index.ts +1 -0
- package/src/components/CoreButton/CoreButton.module.css +71 -0
- package/src/components/CoreButton/CoreButton.test.tsx +24 -0
- package/src/components/CoreButton/CoreButton.tsx +27 -0
- package/src/components/CoreButton/index.ts +1 -0
- package/src/components/CoreField/CoreField.module.css +31 -0
- package/src/components/CoreField/CoreField.test.tsx +15 -0
- package/src/components/CoreField/CoreField.tsx +18 -0
- package/src/components/CoreField/index.ts +1 -0
- package/src/components/CoreSelect/CoreSelect.module.css +37 -0
- package/src/components/CoreSelect/CoreSelect.test.tsx +22 -0
- package/src/components/CoreSelect/CoreSelect.tsx +29 -0
- package/src/components/CoreSelect/index.ts +1 -0
- package/src/components/CoreTabs/CoreTabs.module.css +41 -0
- package/src/components/CoreTabs/CoreTabs.test.tsx +18 -0
- package/src/components/CoreTabs/CoreTabs.tsx +67 -0
- package/src/components/CoreTabs/index.ts +1 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.module.css +61 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.test.tsx +37 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.tsx +41 -0
- package/src/components/DashboardParcelRow/index.ts +1 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.module.css +29 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.test.tsx +15 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.tsx +22 -0
- package/src/components/DataFiltersToolbar/index.ts +1 -0
- package/src/components/DataSearchBar/DataSearchBar.module.css +28 -0
- package/src/components/DataSearchBar/DataSearchBar.test.tsx +15 -0
- package/src/components/DataSearchBar/DataSearchBar.tsx +15 -0
- package/src/components/DataSearchBar/index.ts +1 -0
- package/src/components/DataTable/DataTable.module.css +57 -0
- package/src/components/DataTable/DataTable.test.tsx +12 -0
- package/src/components/DataTable/DataTable.tsx +67 -0
- package/src/components/DataTable/index.ts +1 -0
- package/src/components/Divider/Divider.module.css +29 -0
- package/src/components/Divider/Divider.test.tsx +9 -0
- package/src/components/Divider/Divider.tsx +21 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/DropdownMenu/DropdownMenu.module.css +45 -0
- package/src/components/DropdownMenu/DropdownMenu.test.tsx +21 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +45 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/EmptyState/EmptyState.module.css +52 -0
- package/src/components/EmptyState/EmptyState.test.tsx +20 -0
- package/src/components/EmptyState/EmptyState.tsx +33 -0
- package/src/components/EmptyState/index.ts +1 -0
- package/src/components/FaqItem/FaqItem.module.css +47 -0
- package/src/components/FaqItem/FaqItem.test.tsx +14 -0
- package/src/components/FaqItem/FaqItem.tsx +28 -0
- package/src/components/FaqItem/index.ts +1 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.module.css +83 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.test.tsx +37 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.tsx +58 -0
- package/src/components/FavoriteRelayCard/index.ts +1 -0
- package/src/components/FeatureCard/FeatureCard.module.css +62 -0
- package/src/components/FeatureCard/FeatureCard.test.tsx +10 -0
- package/src/components/FeatureCard/FeatureCard.tsx +30 -0
- package/src/components/FeatureCard/index.ts +1 -0
- package/src/components/FileUpload/FileUpload.module.css +41 -0
- package/src/components/FileUpload/FileUpload.test.tsx +22 -0
- package/src/components/FileUpload/FileUpload.tsx +26 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/FilterPill/FilterPill.module.css +18 -0
- package/src/components/FilterPill/FilterPill.test.tsx +19 -0
- package/src/components/FilterPill/FilterPill.tsx +20 -0
- package/src/components/FilterPill/index.ts +1 -0
- package/src/components/Footer/Footer.module.css +57 -0
- package/src/components/Footer/Footer.test.tsx +10 -0
- package/src/components/Footer/Footer.tsx +63 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Icon/Icon.tsx +20 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/InfoRow/InfoRow.module.css +33 -0
- package/src/components/InfoRow/InfoRow.test.tsx +9 -0
- package/src/components/InfoRow/InfoRow.tsx +21 -0
- package/src/components/InfoRow/index.ts +1 -0
- package/src/components/LinkButton/LinkButton.module.css +22 -0
- package/src/components/LinkButton/LinkButton.test.tsx +9 -0
- package/src/components/LinkButton/LinkButton.tsx +17 -0
- package/src/components/LinkButton/index.ts +1 -0
- package/src/components/LocationCard/LocationCard.module.css +61 -0
- package/src/components/LocationCard/LocationCard.test.tsx +9 -0
- package/src/components/LocationCard/LocationCard.tsx +27 -0
- package/src/components/LocationCard/index.ts +1 -0
- package/src/components/Logo/Logo.module.css +30 -0
- package/src/components/Logo/Logo.tsx +18 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/MetricCard/MetricCard.module.css +27 -0
- package/src/components/MetricCard/MetricCard.test.tsx +10 -0
- package/src/components/MetricCard/MetricCard.tsx +19 -0
- package/src/components/MetricCard/index.ts +1 -0
- package/src/components/Navbar/Navbar.module.css +87 -0
- package/src/components/Navbar/Navbar.test.tsx +21 -0
- package/src/components/Navbar/Navbar.tsx +77 -0
- package/src/components/Navbar/index.ts +1 -0
- package/src/components/NotificationItem/NotificationItem.module.css +73 -0
- package/src/components/NotificationItem/NotificationItem.test.tsx +22 -0
- package/src/components/NotificationItem/NotificationItem.tsx +30 -0
- package/src/components/NotificationItem/index.ts +1 -0
- package/src/components/NotificationRow/NotificationRow.module.css +49 -0
- package/src/components/NotificationRow/NotificationRow.test.tsx +15 -0
- package/src/components/NotificationRow/NotificationRow.tsx +26 -0
- package/src/components/NotificationRow/index.ts +1 -0
- package/src/components/OutcomeModal/OutcomeModal.module.css +101 -0
- package/src/components/OutcomeModal/OutcomeModal.test.tsx +15 -0
- package/src/components/OutcomeModal/OutcomeModal.tsx +45 -0
- package/src/components/OutcomeModal/index.ts +1 -0
- package/src/components/Pagination/Pagination.module.css +27 -0
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +41 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/ParcelCard/ParcelCard.module.css +34 -0
- package/src/components/ParcelCard/ParcelCard.test.tsx +17 -0
- package/src/components/ParcelCard/ParcelCard.tsx +21 -0
- package/src/components/ParcelCard/index.ts +1 -0
- package/src/components/ParcelRow/ParcelRow.module.css +25 -0
- package/src/components/ParcelRow/ParcelRow.test.tsx +18 -0
- package/src/components/ParcelRow/ParcelRow.tsx +31 -0
- package/src/components/ParcelRow/index.ts +1 -0
- package/src/components/ParcelTimeline/ParcelTimeline.module.css +68 -0
- package/src/components/ParcelTimeline/ParcelTimeline.test.tsx +17 -0
- package/src/components/ParcelTimeline/ParcelTimeline.tsx +33 -0
- package/src/components/ParcelTimeline/index.ts +1 -0
- package/src/components/PhotoUpload/PhotoUpload.module.css +39 -0
- package/src/components/PhotoUpload/PhotoUpload.test.tsx +16 -0
- package/src/components/PhotoUpload/PhotoUpload.tsx +29 -0
- package/src/components/PhotoUpload/index.ts +1 -0
- package/src/components/ProcessBadge/ProcessBadge.module.css +29 -0
- package/src/components/ProcessBadge/ProcessBadge.test.tsx +9 -0
- package/src/components/ProcessBadge/ProcessBadge.tsx +19 -0
- package/src/components/ProcessBadge/index.ts +1 -0
- package/src/components/ProgressBar/ProgressBar.module.css +56 -0
- package/src/components/ProgressBar/ProgressBar.test.tsx +18 -0
- package/src/components/ProgressBar/ProgressBar.tsx +33 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/QrScanner/QrScanner.module.css +50 -0
- package/src/components/QrScanner/QrScanner.test.tsx +20 -0
- package/src/components/QrScanner/QrScanner.tsx +27 -0
- package/src/components/QrScanner/index.ts +1 -0
- package/src/components/QuestionSearch/QuestionSearch.module.css +28 -0
- package/src/components/QuestionSearch/QuestionSearch.test.tsx +15 -0
- package/src/components/QuestionSearch/QuestionSearch.tsx +26 -0
- package/src/components/QuestionSearch/index.ts +1 -0
- package/src/components/QuickActionCard/QuickActionCard.module.css +31 -0
- package/src/components/QuickActionCard/QuickActionCard.test.tsx +20 -0
- package/src/components/QuickActionCard/QuickActionCard.tsx +22 -0
- package/src/components/QuickActionCard/index.ts +1 -0
- package/src/components/Radio/Radio.module.css +53 -0
- package/src/components/Radio/Radio.test.tsx +20 -0
- package/src/components/Radio/Radio.tsx +20 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/RelayCard/RelayCard.module.css +38 -0
- package/src/components/RelayCard/RelayCard.test.tsx +22 -0
- package/src/components/RelayCard/RelayCard.tsx +31 -0
- package/src/components/RelayCard/index.ts +1 -0
- package/src/components/RelayResultCard/RelayResultCard.module.css +82 -0
- package/src/components/RelayResultCard/RelayResultCard.test.tsx +10 -0
- package/src/components/RelayResultCard/RelayResultCard.tsx +34 -0
- package/src/components/RelayResultCard/index.ts +1 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.module.css +102 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.test.tsx +16 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.tsx +45 -0
- package/src/components/ResetPasswordCard/index.ts +1 -0
- package/src/components/SearchBar/SearchBar.module.css +33 -0
- package/src/components/SearchBar/SearchBar.test.tsx +19 -0
- package/src/components/SearchBar/SearchBar.tsx +18 -0
- package/src/components/SearchBar/index.ts +1 -0
- package/src/components/Select/Select.module.css +64 -0
- package/src/components/Select/Select.test.tsx +24 -0
- package/src/components/Select/Select.tsx +60 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/ShipmentStatus/ShipmentStatus.module.css +41 -0
- package/src/components/ShipmentStatus/ShipmentStatus.test.tsx +14 -0
- package/src/components/ShipmentStatus/ShipmentStatus.tsx +52 -0
- package/src/components/ShipmentStatus/index.ts +1 -0
- package/src/components/Sidebar/Sidebar.module.css +79 -0
- package/src/components/Sidebar/Sidebar.test.tsx +21 -0
- package/src/components/Sidebar/Sidebar.tsx +98 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/SidebarNavItem/SidebarNavItem.module.css +21 -0
- package/src/components/SidebarNavItem/SidebarNavItem.test.tsx +20 -0
- package/src/components/SidebarNavItem/SidebarNavItem.tsx +22 -0
- package/src/components/SidebarNavItem/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.module.css +22 -0
- package/src/components/Skeleton/Skeleton.test.tsx +9 -0
- package/src/components/Skeleton/Skeleton.tsx +13 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/StatCard/StatCard.module.css +22 -0
- package/src/components/StatCard/StatCard.test.tsx +9 -0
- package/src/components/StatCard/StatCard.tsx +19 -0
- package/src/components/StatCard/index.ts +1 -0
- package/src/components/StatusSummary/StatusSummary.module.css +43 -0
- package/src/components/StatusSummary/StatusSummary.test.tsx +9 -0
- package/src/components/StatusSummary/StatusSummary.tsx +32 -0
- package/src/components/StatusSummary/index.ts +1 -0
- package/src/components/StepCard/StepCard.module.css +48 -0
- package/src/components/StepCard/StepCard.test.tsx +9 -0
- package/src/components/StepCard/StepCard.tsx +27 -0
- package/src/components/StepCard/index.ts +1 -0
- package/src/components/Stepper/Stepper.module.css +66 -0
- package/src/components/Stepper/Stepper.test.tsx +20 -0
- package/src/components/Stepper/Stepper.tsx +39 -0
- package/src/components/Stepper/index.ts +1 -0
- package/src/components/StepsList/StepsList.module.css +35 -0
- package/src/components/StepsList/StepsList.test.tsx +10 -0
- package/src/components/StepsList/StepsList.tsx +24 -0
- package/src/components/StepsList/index.ts +1 -0
- package/src/components/SuccessFeedback/SuccessFeedback.module.css +42 -0
- package/src/components/SuccessFeedback/SuccessFeedback.test.tsx +9 -0
- package/src/components/SuccessFeedback/SuccessFeedback.tsx +21 -0
- package/src/components/SuccessFeedback/index.ts +1 -0
- package/src/components/Switch/Switch.module.css +57 -0
- package/src/components/Switch/Switch.test.tsx +20 -0
- package/src/components/Switch/Switch.tsx +22 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Tabs/Tabs.module.css +26 -0
- package/src/components/Tabs/Tabs.test.tsx +34 -0
- package/src/components/Tabs/Tabs.tsx +38 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tag/Tag.module.css +39 -0
- package/src/components/Tag/Tag.test.tsx +24 -0
- package/src/components/Tag/Tag.tsx +25 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/TextField/TextField.module.css +55 -0
- package/src/components/TextField/TextField.test.tsx +24 -0
- package/src/components/TextField/TextField.tsx +37 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/Toast/Toast.module.css +72 -0
- package/src/components/Toast/Toast.test.tsx +20 -0
- package/src/components/Toast/Toast.tsx +32 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.module.css +37 -0
- package/src/components/Tooltip/Tooltip.test.tsx +22 -0
- package/src/components/Tooltip/Tooltip.tsx +20 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/TrackingBadge/TrackingBadge.module.css +10 -0
- package/src/components/TrackingBadge/TrackingBadge.test.tsx +9 -0
- package/src/components/TrackingBadge/TrackingBadge.tsx +9 -0
- package/src/components/TrackingBadge/index.ts +1 -0
- package/src/components/TrackingCard/TrackingCard.module.css +128 -0
- package/src/components/TrackingCard/TrackingCard.test.tsx +10 -0
- package/src/components/TrackingCard/TrackingCard.tsx +58 -0
- package/src/components/TrackingCard/index.ts +1 -0
- package/src/components/TrackingSearch/TrackingSearch.module.css +35 -0
- package/src/components/TrackingSearch/TrackingSearch.test.tsx +15 -0
- package/src/components/TrackingSearch/TrackingSearch.tsx +24 -0
- package/src/components/TrackingSearch/index.ts +1 -0
- package/src/components/ValueCard/ValueCard.module.css +38 -0
- package/src/components/ValueCard/ValueCard.test.tsx +9 -0
- package/src/components/ValueCard/ValueCard.tsx +24 -0
- package/src/components/ValueCard/index.ts +1 -0
- package/src/lib/cn.ts +3 -0
- package/src/main.tsx +10 -0
- package/src/styles/global.css +36 -0
- package/src/styles/tokens.css +61 -0
- package/src/test/setup.ts +9 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.app.tsbuildinfo +1 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +18 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/vite.config.ts +12 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './ProcessBadge.module.css';
|
|
3
|
+
|
|
4
|
+
export type ProcessBadgeState = 'pending' | 'success' | 'error';
|
|
5
|
+
|
|
6
|
+
const LABELS: Record<ProcessBadgeState, string> = {
|
|
7
|
+
pending: 'En cours de traitement',
|
|
8
|
+
success: 'En cours de traitement',
|
|
9
|
+
error: 'En cours de traitement',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface ProcessBadgeProps {
|
|
13
|
+
state?: ProcessBadgeState;
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function ProcessBadge({ state = 'pending', label }: ProcessBadgeProps) {
|
|
18
|
+
return <span className={cn(styles.badge, styles[state])}>{label ?? LABELS[state]}</span>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProcessBadge, type ProcessBadgeProps, type ProcessBadgeState } from './ProcessBadge';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.progress {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 6px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.row {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
color: var(--color-text-secondary);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.label {
|
|
16
|
+
font-weight: 600;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.value {
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.active {
|
|
24
|
+
color: var(--color-primary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.done {
|
|
28
|
+
color: var(--color-success);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.idle {
|
|
32
|
+
color: var(--color-text-secondary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.track {
|
|
36
|
+
height: 8px;
|
|
37
|
+
width: 100%;
|
|
38
|
+
border-radius: var(--radius-pill);
|
|
39
|
+
background: var(--color-surface-sunken);
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.fill {
|
|
44
|
+
display: block;
|
|
45
|
+
height: 100%;
|
|
46
|
+
border-radius: var(--radius-pill);
|
|
47
|
+
background: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.fill.active {
|
|
51
|
+
background: var(--color-primary);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.fill.done {
|
|
55
|
+
background: var(--color-success);
|
|
56
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { ProgressBar } from './ProgressBar';
|
|
3
|
+
|
|
4
|
+
describe('<ProgressBar>', () => {
|
|
5
|
+
it('should render the label and the percentage', () => {
|
|
6
|
+
render(<ProgressBar label="En cours de traitement" value={65} />);
|
|
7
|
+
expect(screen.getByText('En cours de traitement')).toBeInTheDocument();
|
|
8
|
+
expect(screen.getByText('65%')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should expose the current value to assistive tech', () => {
|
|
12
|
+
render(<ProgressBar label="Livraison terminée" value={100} />);
|
|
13
|
+
expect(screen.getByRole('progressbar', { name: 'Livraison terminée' })).toHaveAttribute(
|
|
14
|
+
'aria-valuenow',
|
|
15
|
+
'100',
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './ProgressBar.module.css';
|
|
3
|
+
|
|
4
|
+
export interface ProgressBarProps {
|
|
5
|
+
/** Valeur entre 0 et 100. */
|
|
6
|
+
value: number;
|
|
7
|
+
label: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function ProgressBar({ value, label, className }: ProgressBarProps) {
|
|
12
|
+
const percent = Math.min(100, Math.max(0, value));
|
|
13
|
+
const tone = percent === 100 ? 'done' : percent === 0 ? 'idle' : 'active';
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={cn(styles.progress, className)}>
|
|
17
|
+
<div className={styles.row}>
|
|
18
|
+
<span className={styles.label}>{label}</span>
|
|
19
|
+
<span className={cn(styles.value, styles[tone])}>{percent}%</span>
|
|
20
|
+
</div>
|
|
21
|
+
<div
|
|
22
|
+
className={styles.track}
|
|
23
|
+
role="progressbar"
|
|
24
|
+
aria-valuenow={percent}
|
|
25
|
+
aria-valuemin={0}
|
|
26
|
+
aria-valuemax={100}
|
|
27
|
+
aria-label={label}
|
|
28
|
+
>
|
|
29
|
+
<span className={cn(styles.fill, styles[tone])} style={{ width: `${percent}%` }} />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressBar, type ProgressBarProps } from './ProgressBar';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.scanner {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 20px;
|
|
6
|
+
width: 390px;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
padding: 24px;
|
|
9
|
+
border-radius: 24px;
|
|
10
|
+
background: var(--color-sidebar);
|
|
11
|
+
color: #fff;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.scanner h2 {
|
|
16
|
+
margin: 0;
|
|
17
|
+
font-size: 22px;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.hint {
|
|
22
|
+
margin: 0;
|
|
23
|
+
color: var(--color-text-placeholder);
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.viewfinder {
|
|
28
|
+
width: 280px;
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
aspect-ratio: 1;
|
|
31
|
+
border: 3px solid var(--color-primary);
|
|
32
|
+
border-radius: 28px;
|
|
33
|
+
background: var(--color-ink);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.actions {
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
align-items: center;
|
|
40
|
+
font-size: 11px;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.actions button {
|
|
45
|
+
border: 0;
|
|
46
|
+
background: transparent;
|
|
47
|
+
color: #fff;
|
|
48
|
+
font: inherit;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { QrScanner } from './QrScanner';
|
|
4
|
+
|
|
5
|
+
describe('<QrScanner>', () => {
|
|
6
|
+
it('should render the scanner instructions', () => {
|
|
7
|
+
render(<QrScanner />);
|
|
8
|
+
expect(screen.getByRole('heading', { name: 'Scanner un QR code' })).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onManual when manual entry is activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onManual = vi.fn();
|
|
14
|
+
render(<QrScanner onManual={onManual} />);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: 'Saisie manuelle' }));
|
|
17
|
+
|
|
18
|
+
expect(onManual).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './QrScanner.module.css';
|
|
3
|
+
|
|
4
|
+
export interface QrScannerProps {
|
|
5
|
+
onTorch?: () => void;
|
|
6
|
+
onManual?: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function QrScanner({ onTorch, onManual, className }: QrScannerProps) {
|
|
11
|
+
return (
|
|
12
|
+
<section className={cn(styles.scanner, className)}>
|
|
13
|
+
<h2>Scanner un QR code</h2>
|
|
14
|
+
<p className={styles.hint}>Placez le code du colis dans le cadre.</p>
|
|
15
|
+
<div className={styles.viewfinder} aria-hidden="true" />
|
|
16
|
+
<div className={styles.actions}>
|
|
17
|
+
<button type="button" onClick={onTorch}>
|
|
18
|
+
Lampe
|
|
19
|
+
</button>
|
|
20
|
+
<span aria-hidden="true">•</span>
|
|
21
|
+
<button type="button" onClick={onManual}>
|
|
22
|
+
Saisie manuelle
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QrScanner, type QrScannerProps } from './QrScanner';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.bar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: 648px;
|
|
7
|
+
height: 50px;
|
|
8
|
+
padding: 0 16px;
|
|
9
|
+
border: 1px solid #e8eaee;
|
|
10
|
+
border-radius: 14px;
|
|
11
|
+
background: #f3f4f6;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.input {
|
|
15
|
+
flex: 1;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
border: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
color: #191d26;
|
|
20
|
+
font: inherit;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input::placeholder {
|
|
27
|
+
color: #606978;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { QuestionSearch } from './QuestionSearch';
|
|
4
|
+
|
|
5
|
+
describe('<QuestionSearch>', () => {
|
|
6
|
+
it('should submit the typed query', async () => {
|
|
7
|
+
const user = userEvent.setup();
|
|
8
|
+
const onSubmit = vi.fn();
|
|
9
|
+
render(<QuestionSearch onSubmit={onSubmit} />);
|
|
10
|
+
|
|
11
|
+
await user.type(screen.getByPlaceholderText('Rechercher une question'), 'livraison{enter}');
|
|
12
|
+
|
|
13
|
+
expect(onSubmit).toHaveBeenCalledWith('livraison');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FormEvent, InputHTMLAttributes } from 'react';
|
|
2
|
+
import searchIcon from '@/assets/icons/core-search.svg';
|
|
3
|
+
import styles from './QuestionSearch.module.css';
|
|
4
|
+
|
|
5
|
+
export interface QuestionSearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onSubmit'> {
|
|
6
|
+
onSubmit?: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function QuestionSearch({
|
|
10
|
+
placeholder = 'Rechercher une question',
|
|
11
|
+
onSubmit,
|
|
12
|
+
...props
|
|
13
|
+
}: QuestionSearchProps) {
|
|
14
|
+
function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
const data = new FormData(event.currentTarget);
|
|
17
|
+
onSubmit?.(String(data.get('query') ?? ''));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<form className={styles.bar} onSubmit={handleSubmit}>
|
|
22
|
+
<img src={searchIcon} alt="" width={18} height={18} />
|
|
23
|
+
<input name="query" className={styles.input} placeholder={placeholder} {...props} />
|
|
24
|
+
</form>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QuestionSearch, type QuestionSearchProps } from './QuestionSearch';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
width: 420px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
height: 92px;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
border: 1px solid var(--color-border);
|
|
10
|
+
border-radius: var(--radius-lg);
|
|
11
|
+
background: #fff;
|
|
12
|
+
text-align: left;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card span:first-child {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 4px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.title {
|
|
23
|
+
color: var(--color-text);
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.description {
|
|
29
|
+
color: var(--color-text-secondary);
|
|
30
|
+
font-size: 13px;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { QuickActionCard } from './QuickActionCard';
|
|
4
|
+
|
|
5
|
+
describe('<QuickActionCard>', () => {
|
|
6
|
+
it('should render the action', () => {
|
|
7
|
+
render(<QuickActionCard title="Envoyer un colis" description="Préparez un nouvel envoi" />);
|
|
8
|
+
expect(screen.getByRole('button', { name: /Envoyer un colis/ })).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onClick when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onClick = vi.fn();
|
|
14
|
+
render(<QuickActionCard title="Envoyer un colis" description="Préparez un nouvel envoi" onClick={onClick} />);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: /Envoyer un colis/ }));
|
|
17
|
+
|
|
18
|
+
expect(onClick).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import { Icon } from '@/components/Icon';
|
|
3
|
+
import styles from './QuickActionCard.module.css';
|
|
4
|
+
|
|
5
|
+
export interface QuickActionCardProps {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function QuickActionCard({ title, description, onClick, className }: QuickActionCardProps) {
|
|
13
|
+
return (
|
|
14
|
+
<button type="button" className={cn(styles.card, className)} onClick={onClick}>
|
|
15
|
+
<span>
|
|
16
|
+
<span className={styles.title}>{title}</span>
|
|
17
|
+
<span className={styles.description}>{description}</span>
|
|
18
|
+
</span>
|
|
19
|
+
<Icon name="arrowRight" size={20} />
|
|
20
|
+
</button>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QuickActionCard, type QuickActionCardProps } from './QuickActionCard';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.control {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.input {
|
|
9
|
+
position: absolute;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
width: 24px;
|
|
12
|
+
height: 24px;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.circle {
|
|
17
|
+
width: 24px;
|
|
18
|
+
height: 24px;
|
|
19
|
+
border: 1px solid var(--color-border);
|
|
20
|
+
border-radius: var(--radius-pill);
|
|
21
|
+
background: #fff;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.circle::after {
|
|
28
|
+
content: '';
|
|
29
|
+
width: 10px;
|
|
30
|
+
height: 10px;
|
|
31
|
+
border-radius: var(--radius-pill);
|
|
32
|
+
background: #fff;
|
|
33
|
+
transform: scale(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input:checked + .circle {
|
|
37
|
+
background: var(--color-primary);
|
|
38
|
+
border-color: var(--color-primary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input:checked + .circle::after {
|
|
42
|
+
transform: scale(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input:focus-visible + .circle {
|
|
46
|
+
outline: 2px solid var(--color-primary);
|
|
47
|
+
outline-offset: 2px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.label {
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
color: var(--color-text);
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Radio } from './Radio';
|
|
4
|
+
|
|
5
|
+
describe('<Radio>', () => {
|
|
6
|
+
it('should render an unselected radio', () => {
|
|
7
|
+
render(<Radio name="mode" label="Point relais" />);
|
|
8
|
+
expect(screen.getByRole('radio', { name: 'Point relais' })).not.toBeChecked();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should select the radio when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
render(<Radio name="mode" label="Point relais" />);
|
|
14
|
+
const radio = screen.getByRole('radio', { name: 'Point relais' });
|
|
15
|
+
|
|
16
|
+
await user.click(radio);
|
|
17
|
+
|
|
18
|
+
expect(radio).toBeChecked();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useId, type InputHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
import styles from './Radio.module.css';
|
|
4
|
+
|
|
5
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Radio({ label, id, className, ...props }: RadioProps) {
|
|
10
|
+
const generatedId = useId();
|
|
11
|
+
const fieldId = id ?? generatedId;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<label className={cn(styles.control, className)} htmlFor={fieldId}>
|
|
15
|
+
<input id={fieldId} className={styles.input} type="radio" {...props} />
|
|
16
|
+
<span className={styles.circle} aria-hidden="true" />
|
|
17
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
18
|
+
</label>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Radio, type RadioProps } from './Radio';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
gap: 7px;
|
|
6
|
+
width: 410px;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
padding: 16px 18px;
|
|
9
|
+
border: 1px solid var(--color-border);
|
|
10
|
+
border-radius: var(--radius-card);
|
|
11
|
+
background: #fff;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.name {
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
font-weight: 600;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.location {
|
|
20
|
+
font-size: 11px;
|
|
21
|
+
color: var(--color-text-secondary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.hours {
|
|
25
|
+
font-size: 11px;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
color: var(--color-success);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.map {
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 0;
|
|
33
|
+
background: transparent;
|
|
34
|
+
color: var(--color-primary);
|
|
35
|
+
font-size: 11px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { RelayCard } from './RelayCard';
|
|
4
|
+
|
|
5
|
+
describe('<RelayCard>', () => {
|
|
6
|
+
it('should render the relay name', () => {
|
|
7
|
+
render(<RelayCard name="Carrefour Cocody" location="Cocody · 1,2 km" hours="Ouvert · ferme à 20:00" />);
|
|
8
|
+
expect(screen.getByText('Carrefour Cocody')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onMapClick when the map action is activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onMapClick = vi.fn();
|
|
14
|
+
render(
|
|
15
|
+
<RelayCard name="Carrefour Cocody" location="Cocody" hours="Ouvert" onMapClick={onMapClick} />,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
await user.click(screen.getByRole('button', { name: 'Voir sur la carte →' }));
|
|
19
|
+
|
|
20
|
+
expect(onMapClick).toHaveBeenCalledOnce();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './RelayCard.module.css';
|
|
3
|
+
|
|
4
|
+
export interface RelayCardProps {
|
|
5
|
+
name: string;
|
|
6
|
+
location: string;
|
|
7
|
+
hours: string;
|
|
8
|
+
mapLabel?: string;
|
|
9
|
+
onMapClick?: () => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function RelayCard({
|
|
14
|
+
name,
|
|
15
|
+
location,
|
|
16
|
+
hours,
|
|
17
|
+
mapLabel = 'Voir sur la carte →',
|
|
18
|
+
onMapClick,
|
|
19
|
+
className,
|
|
20
|
+
}: RelayCardProps) {
|
|
21
|
+
return (
|
|
22
|
+
<article className={cn(styles.card, className)}>
|
|
23
|
+
<p className={styles.name}>{name}</p>
|
|
24
|
+
<p className={styles.location}>{location}</p>
|
|
25
|
+
<p className={styles.hours}>{hours}</p>
|
|
26
|
+
<button type="button" className={styles.map} onClick={onMapClick}>
|
|
27
|
+
{mapLabel}
|
|
28
|
+
</button>
|
|
29
|
+
</article>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RelayCard, type RelayCardProps } from './RelayCard';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: 504px;
|
|
7
|
+
padding: 16px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border: 0;
|
|
10
|
+
border-left: 4px solid #d34860;
|
|
11
|
+
border-radius: 16px;
|
|
12
|
+
background: #fff5f6;
|
|
13
|
+
box-shadow: 0 6px 16px rgb(0 0 0 / 4%);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.content {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex: 1;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 6px;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.name {
|
|
25
|
+
margin: 0;
|
|
26
|
+
color: #191d26;
|
|
27
|
+
font-size: 15px;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
line-height: 1.3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.meta {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.status {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
color: #16a34a;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
line-height: 1.3;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dot {
|
|
49
|
+
width: 8px;
|
|
50
|
+
height: 8px;
|
|
51
|
+
border-radius: 999px;
|
|
52
|
+
background: #16a34a;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.badge {
|
|
56
|
+
padding: 6px 10px;
|
|
57
|
+
border-radius: 999px;
|
|
58
|
+
background: #d34860;
|
|
59
|
+
color: #fff;
|
|
60
|
+
font-size: 11px;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
line-height: 1.3;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.address {
|
|
66
|
+
margin: 0;
|
|
67
|
+
color: #606978;
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
line-height: 1.5;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.distance {
|
|
73
|
+
padding: 6px 10px;
|
|
74
|
+
border: 1px solid #e8eaee;
|
|
75
|
+
border-radius: 999px;
|
|
76
|
+
background: #f9fafb;
|
|
77
|
+
color: #d34860;
|
|
78
|
+
font-size: 11px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
line-height: 1.3;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { RelayResultCard } from './RelayResultCard';
|
|
3
|
+
|
|
4
|
+
describe('<RelayResultCard>', () => {
|
|
5
|
+
it('should render the relay name and the open status', () => {
|
|
6
|
+
render(<RelayResultCard />);
|
|
7
|
+
expect(screen.getByText('Carrefour City - 350 m')).toBeInTheDocument();
|
|
8
|
+
expect(screen.getByText('Ouvert')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|