Skip to content

Commit e1fa1e0

Browse files
author
eriviere
committed
fix: answered MR responses
1 parent 9b4a08e commit e1fa1e0

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

example/src/components/Callout/Callout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const CalloutExample = () => (
1717
</Callout>
1818
</Col>
1919
<Col n="12" spacing="py-2w">
20-
<Callout>
20+
<Callout icon={null}>
2121
<CalloutTitle>Mise en avant</CalloutTitle>
2222
<CalloutText>Callout text that might be short and concise.</CalloutText>
2323
</Callout>

src/components/interface/Callout/Callout.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ export type CalloutColorFamily = 'green-tilleul-verveine' | 'green-bourgeon' | '
55
export type CalloutChildren = React.ReactNode[] | React.ReactNode;
66

77
export interface CalloutProps {
8+
/**
9+
* @deprecated The method should not be used
10+
*/
811
hasInfoIcon?: boolean;
12+
icon?: Nullable<string>;
913
colorFamily?: CalloutColorFamily;
1014
/**
1115
* first color is color of the border, second is background

src/components/interface/Callout/Callout.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Callout = ({
2525
const [color, backgroundColor] = colors;
2626
const calloutRef = useRef();
2727
const _className = classNames('fr-callout', className, {
28-
[`fr-fi-${icon}`]: icon,
28+
[icon]: icon,
2929
[`fr-callout--${colorFamily}`]: colorFamily,
3030
});
3131

@@ -52,15 +52,18 @@ const Callout = ({
5252
};
5353

5454
Callout.defaultProps = {
55-
icon: 'information-line',
55+
icon: 'fr-fi-information-line',
5656
hasInfoIcon: true,
5757
className: '',
5858
colors: [],
5959
colorFamily: '',
6060
};
6161

6262
Callout.propTypes = {
63-
icon: PropTypes.string,
63+
icon: PropTypes.oneOfType([
64+
PropTypes.oneOf([null]),
65+
PropTypes.string,
66+
]),
6467
hasInfoIcon: PropTypes.bool,
6568
colorFamily: PropTypes.oneOf([...colorFamilies, '']),
6669
/**

src/components/interface/Callout/Callout.stories.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,24 @@ ButtonCallout.storyName = 'Mise en avant avec bouton';
3939

4040
export const WithoutIconCallout = Template.bind({});
4141
WithoutIconCallout.args = {
42-
hasInfoIcon: false,
42+
icon: null,
4343
children: [
4444
<CalloutTitle as="h3">Callout title</CalloutTitle>,
4545
<CalloutText>Callout text that might be short and concise.</CalloutText>,
4646
],
4747
};
4848
WithoutIconCallout.storyName = 'Mise en avant sans icone';
4949

50+
export const DifferentIconCallout = Template.bind({});
51+
DifferentIconCallout.args = {
52+
icon: 'fr-fi-lock-line',
53+
children: [
54+
<CalloutTitle as="h3">Callout title</CalloutTitle>,
55+
<CalloutText>Callout text that might be short and concise.</CalloutText>,
56+
],
57+
};
58+
DifferentIconCallout.storyName = 'Mise en avant avec une autre icone';
59+
5060
export const ColoredCallout = Template.bind({});
5161
ColoredCallout.args = {
5262
colors: ['#f13d3d', '#ffb0b0'],

0 commit comments

Comments
 (0)