Skip to content

Commit d7b9ade

Browse files
committed
2 parents 7741754 + 863578f commit d7b9ade

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

src/Card.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type CardProps = {
1515
id?: string;
1616
className?: string;
1717
title: ReactNode;
18+
titleAs?: `h${2 | 3 | 4 | 5 | 6}`;
1819
desc?: ReactNode;
1920
imageUrl?: string;
2021
imageAlt?: string;
@@ -81,6 +82,7 @@ export const Card = memo(
8182
id: props_id,
8283
className,
8384
title,
85+
titleAs: HtmlTitleTag = "h3",
8486
linkProps,
8587
desc,
8688
imageUrl,
@@ -146,7 +148,7 @@ export const Card = memo(
146148
>
147149
<div className={cx(fr.cx("fr-card__body"), classes.body)}>
148150
<div className={cx(fr.cx("fr-card__content"), classes.content)}>
149-
<h3 className={cx(fr.cx("fr-card__title"), classes.title)}>
151+
<HtmlTitleTag className={cx(fr.cx("fr-card__title"), classes.title)}>
150152
{linkProps !== undefined ? (
151153
<Link
152154
{...linkProps}
@@ -157,7 +159,7 @@ export const Card = memo(
157159
) : (
158160
title
159161
)}
160-
</h3>
162+
</HtmlTitleTag>
161163
{desc !== undefined && (
162164
<p className={cx(fr.cx("fr-card__desc"), classes.desc)}>{desc}</p>
163165
)}

src/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export const Input = memo(
156156
)}
157157
disabled={disabled || undefined}
158158
aria-describedby={messageId}
159-
type={nativeInputProps?.type ?? "text"}
159+
type={textArea ? undefined : nativeInputProps?.type ?? "text"}
160160
id={inputId}
161161
/>
162162
);

src/SelectNext.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ export default Select;
174174
const { useTranslation, addSelectTranslations } = createComponentI18nApi({
175175
"componentName": symToStr({ Select }),
176176
"frMessages": {
177-
/* spell-checker: disable */
178-
"select an option": "Selectioner une option"
179-
/* spell-checker: enable */
177+
"select an option": "Sélectionner une option"
180178
}
181179
});
182180

stories/Card.stories.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ const { meta, getStory } = getStoryFactory({
1818
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Card.tsx)`,
1919
"argTypes": {
2020
"title": { "description": `Required.` },
21+
titleAs: {
22+
"description": `Heading level`,
23+
"options": (() => {
24+
const headings = ["h2", "h3", "h4", "h5", "h6"] as const;
25+
assert<Equals<typeof headings[number] | undefined, CardProps["titleAs"]>>();
26+
return headings;
27+
})(),
28+
"control": { "type": "radio" }
29+
},
2130
"desc": { "description": `` },
2231
linkProps: {
2332
"description": `Required only if enlargeLink is true. The Card Link props.`
@@ -30,9 +39,7 @@ const { meta, getStory } = getStoryFactory({
3039
"description": "Card title text sizing",
3140
"options": (() => {
3241
const sizes = ["small", "medium", "large"] as const;
33-
3442
assert<Equals<typeof sizes[number] | undefined, CardProps["size"]>>();
35-
3643
return sizes;
3744
})(),
3845
"control": { "type": "radio" }
@@ -49,6 +56,7 @@ export default meta;
4956
const defaultProps = {
5057
"enlargeLink": true as const,
5158
"title": "Intitulé de la carte (sur lequel se trouve le lien)",
59+
"titleAs": "h3" as const,
5260
"linkProps": {
5361
"href": "#"
5462
},

0 commit comments

Comments
 (0)