Compare commits
3 Commits
02c1fb33d0
...
6ae21a2427
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ae21a2427 | |||
| 29342d796c | |||
| 60e3c92511 |
Binary file not shown.
Binary file not shown.
@@ -4,31 +4,34 @@ interface SiteCardProps {
|
||||
config: SiteCardConfig;
|
||||
selected: boolean;
|
||||
onSelect: () => void;
|
||||
variant?: "default" | "situation";
|
||||
}
|
||||
|
||||
export function SiteCard({
|
||||
config,
|
||||
selected,
|
||||
onSelect,
|
||||
variant = "default",
|
||||
}: SiteCardProps): React.JSX.Element {
|
||||
const { label, imagePath, disabled } = config;
|
||||
const isSituation = variant === "situation";
|
||||
|
||||
const getBackground = (): string => {
|
||||
if (imagePath) return `url(${imagePath}) center/cover`;
|
||||
if (disabled) return "#b8b8b8";
|
||||
if (selected) return "#d9d9d9";
|
||||
return "#e8e8e8";
|
||||
if (disabled) return "rgba(255, 255, 255, 0.42)";
|
||||
return "#b8b8b8";
|
||||
};
|
||||
|
||||
const getBorder = (): string => {
|
||||
if (selected) return "3px solid #a8d5a2";
|
||||
if (disabled) return "none";
|
||||
return "2px solid #ffffff";
|
||||
if (isSituation) return "3px solid rgba(255, 255, 255, 0.55)";
|
||||
if (disabled) return "3px solid rgba(255, 255, 255, 0.55)";
|
||||
return "3px solid rgba(255, 255, 255, 0.55)";
|
||||
};
|
||||
|
||||
const getTextColor = (): string => {
|
||||
if (disabled) return "#888888";
|
||||
return "#666666";
|
||||
if (disabled) return "rgba(77, 77, 77, 0.72)";
|
||||
return "#4d4d4d";
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -37,8 +40,12 @@ export function SiteCard({
|
||||
onClick={onSelect}
|
||||
disabled={disabled}
|
||||
style={{
|
||||
width: "clamp(120px, 15vw, 160px)",
|
||||
height: "clamp(140px, 18vw, 180px)",
|
||||
width: isSituation
|
||||
? "clamp(220px, 24vw, 300px)"
|
||||
: "clamp(120px, 15vw, 160px)",
|
||||
height: isSituation
|
||||
? "clamp(48px, 6vw, 60px)"
|
||||
: "clamp(140px, 18vw, 180px)",
|
||||
border: getBorder(),
|
||||
background: getBackground(),
|
||||
cursor: disabled ? "not-allowed" : "pointer",
|
||||
@@ -54,10 +61,13 @@ export function SiteCard({
|
||||
<span
|
||||
style={{
|
||||
color: getTextColor(),
|
||||
fontSize: "clamp(10px, 1.5vw, 14px)",
|
||||
fontWeight: 500,
|
||||
fontSize: isSituation
|
||||
? "clamp(14px, 1.8vw, 22px)"
|
||||
: "clamp(10px, 1.5vw, 14px)",
|
||||
fontWeight: isSituation ? 700 : 500,
|
||||
textAlign: "center",
|
||||
padding: 8,
|
||||
lineHeight: 1,
|
||||
}}
|
||||
>
|
||||
{label}
|
||||
|
||||
@@ -38,16 +38,12 @@ export function SiteNamingScreen(): React.JSX.Element {
|
||||
inputRef.current?.focus();
|
||||
}, []);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent<HTMLInputElement>): void => {
|
||||
e.preventDefault();
|
||||
|
||||
// Only process if not complete and it's a letter key
|
||||
if (!isComplete && e.key.length === 1 && /[a-zA-Z]/.test(e.key)) {
|
||||
setCharIndex((prev) => Math.min(prev + 1, forcedName.length));
|
||||
}
|
||||
const handleNameChange = useCallback(
|
||||
(event: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
const nextLength = Math.min(event.target.value.length, forcedName.length);
|
||||
setCharIndex(nextLength);
|
||||
},
|
||||
[isComplete, forcedName.length],
|
||||
[forcedName.length],
|
||||
);
|
||||
|
||||
const handleConfirm = (): void => {
|
||||
@@ -99,8 +95,7 @@ export function SiteNamingScreen(): React.JSX.Element {
|
||||
ref={inputRef}
|
||||
type="text"
|
||||
value={displayValue}
|
||||
onKeyDown={handleKeyDown}
|
||||
readOnly
|
||||
onChange={handleNameChange}
|
||||
placeholder="Écrivez votre prénom ici"
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -114,7 +109,7 @@ export function SiteNamingScreen(): React.JSX.Element {
|
||||
background: "#D9D9D9",
|
||||
outline: "none",
|
||||
color: "#333",
|
||||
caretColor: "transparent",
|
||||
caretColor: "#333",
|
||||
fontFamily: "Inter, system-ui, sans-serif",
|
||||
fontSize: "clamp(16px, 2.5vw, 20px)",
|
||||
textAlign: "left",
|
||||
|
||||
@@ -52,10 +52,11 @@ export function SiteSituationScreen(): React.JSX.Element {
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 16,
|
||||
flexWrap: "wrap",
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, minmax(220px, 300px))",
|
||||
gap: "24px 28px",
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{SITUATION_CARDS.map((card, index) => (
|
||||
@@ -63,6 +64,7 @@ export function SiteSituationScreen(): React.JSX.Element {
|
||||
key={card.id}
|
||||
config={card}
|
||||
selected={selectedSituation === index}
|
||||
variant="situation"
|
||||
onSelect={() => {
|
||||
if (!card.disabled) {
|
||||
setSelectedSituation(index);
|
||||
|
||||
@@ -24,12 +24,12 @@ export const EXPERIENCE_CARDS: readonly SiteCardConfig[] = [
|
||||
* Cards for screen 2: "Quelle est votre situation ?"
|
||||
*/
|
||||
export const SITUATION_CARDS: readonly SiteCardConfig[] = [
|
||||
{ id: "sit-habitants", label: "Habitants d'Altera", disabled: true },
|
||||
{ id: "sit-apprentis", label: "Apprentis-Citoyens", disabled: true },
|
||||
{ id: "sit-refugie-climat", label: "Sans domicile fixe", disabled: true },
|
||||
{ id: "sit-refugie-guerre", label: "Réfugié.e de guerre", disabled: true },
|
||||
{
|
||||
id: "sit-refugies",
|
||||
label: "Réfugiés Climatiques arrivants",
|
||||
id: "sit-sans-domicile",
|
||||
label: "Réfugié.e climatique",
|
||||
disabled: false,
|
||||
},
|
||||
{ id: "sit-seniors", label: "Seniors Hyper-Connectés", disabled: true },
|
||||
{ id: "sit-autre", label: "Autre", disabled: true },
|
||||
];
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
||||
|
||||
@font-face {
|
||||
font-family: "Nersans One";
|
||||
src:
|
||||
url("/fonts/NersansOne.woff2") format("woff2"),
|
||||
url("/fonts/NersansOne.woff") format("woff");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* Base document reset */
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
|
||||
Reference in New Issue
Block a user