Skip to content

Commit

Permalink
Banner: update close trigger styles for closable variant (#220)
Browse files Browse the repository at this point in the history
* style: update default button style

* chore: add changeset

* chore: extract on click handler
  • Loading branch information
Twonarly1 authored Feb 2, 2024
1 parent 37eb1b3 commit 8eea622
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-fans-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@animareflection/ui": patch
---

Update `Banner` close trigger styles
9 changes: 7 additions & 2 deletions src/components/core/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const PandaBanner = panda("div", banner);
const Banner = ({ children, closable, ...rest }: Props) => {
const [isOpen, setIsOpen] = useState<boolean>(true);

const handleClose = () => setIsOpen(false);

if (!isOpen) return null;

return (
Expand All @@ -29,10 +31,13 @@ const Banner = ({ children, closable, ...rest }: Props) => {
</panda.div>
{closable && (
<Button
onClick={() => setIsOpen(false)}
size="xs"
p={1}
opacity={{ _hover: 0.8 }}
display="flex"
bgColor="transparent"
aria-label="Close Banner"
_hover={{ opacity: 0.8 }}
onClick={handleClose}
>
<Icon color="inherit">
<CloseIcon />
Expand Down

0 comments on commit 8eea622

Please sign in to comment.