Skip to content

Commit

Permalink
Merge pull request #50 from pepabo/callout-closebutton
Browse files Browse the repository at this point in the history
Calloutコンポーネントに閉じるボタンを追加します
  • Loading branch information
changmaru authored Jan 22, 2025
2 parents 1ea8bb5 + 02da045 commit 76ac99c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/callout/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
margin-block-end: 0;
}

._trailing {
margin-left: auto;
}

@include -state-style(map.get($options, color));
@include -size-style(map.get($options, size));

Expand Down
9 changes: 9 additions & 0 deletions packages/stories-web/src/components/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export interface Props {
"informative" | "positive" | "negative" | "notice"
>;
size?: Extract<Size, 's' | 'm' | 'l'>;
hasButton?: boolean;
}

const Callout: FC<Props> = (props: Props) => {
const wrapperClasses = ['in-callout']
const {
color = "informative",
size = "m",
hasButton = false,
children
} = props

Expand All @@ -27,6 +29,13 @@ const Callout: FC<Props> = (props: Props) => {
<div className="_body">
{ children }
</div>
{ hasButton && (
<div className="_trailing">
<button className="in-button -size-s -appearance-transparent">
<div className="_body">閉じる</div>
</button>
</div>
)}
</div>
)
}
Expand Down

0 comments on commit 76ac99c

Please sign in to comment.