Skip to content

Commit 0d9b9ce

Browse files
authored
Fix announcement banner margin (#3056)
1 parent 7bb37c7 commit 0d9b9ce

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

packages/gitbook/src/components/Announcement/AnnouncementBanner.tsx

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,52 +26,56 @@ export function AnnouncementBanner(props: {
2626
const style = BANNER_STYLES[announcement.style];
2727

2828
return (
29-
<div className="announcement-banner scroll-nojump theme-bold:bg-header-background pt-4 pb-2">
30-
<div className={tcls('relative', CONTAINER_STYLE)}>
31-
<Tag
32-
href={contentRef?.href ?? ''}
33-
className={tcls(
34-
'flex w-full items-start justify-center overflow-hidden rounded-md straight-corners:rounded-none px-4 py-3 text-neutral-strong text-sm theme-bold:ring-1 theme-gradient:ring-1 ring-inset transition-colors',
35-
style.container,
36-
closeable && 'pr-12',
37-
hasLink && style.hover
38-
)}
39-
>
40-
<Icon
41-
icon={style.icon as IconName}
42-
className={`mt-0.5 mr-3 size-4 shrink-0 ${style.iconColor}`}
43-
/>
44-
<div>
45-
{announcement.message}
46-
{hasLink ? (
47-
<div className={tcls(linkStyles, style.link, 'ml-1 inline')}>
48-
{contentRef?.icon ? (
49-
<span className="mr-1 ml-2 *:inline">{contentRef?.icon}</span>
50-
) : null}
51-
{announcement.link?.title && (
52-
<span className="mr-1">{announcement.link?.title}</span>
53-
)}
54-
<Icon
55-
icon={
56-
announcement.link?.to.kind === 'url'
57-
? 'arrow-up-right'
58-
: 'chevron-right'
59-
}
60-
className={tcls('mb-0.5 inline size-3')}
61-
/>
62-
</div>
63-
) : null}
64-
</div>
65-
</Tag>
66-
{closeable ? (
67-
<button
68-
className={`absolute top-0 right-4 mt-2 mr-2 rounded straight-corners:rounded-none p-1.5 transition-all hover:ring-1 sm:right-6 md:right-8 ${style.close}`}
69-
type="button"
70-
onClick={dismissAnnouncement}
29+
<div className="announcement-banner theme-bold:bg-header-background pt-4 pb-2">
30+
<div className="scroll-nojump">
31+
<div className={tcls('relative', CONTAINER_STYLE)}>
32+
<Tag
33+
href={contentRef?.href ?? ''}
34+
className={tcls(
35+
'flex w-full items-start justify-center overflow-hidden rounded-md straight-corners:rounded-none px-4 py-3 text-neutral-strong text-sm theme-bold:ring-1 theme-gradient:ring-1 ring-inset transition-colors',
36+
style.container,
37+
closeable && 'pr-12',
38+
hasLink && style.hover
39+
)}
7140
>
72-
<Icon icon="close" className="size-4" />
73-
</button>
74-
) : null}
41+
<Icon
42+
icon={style.icon as IconName}
43+
className={`mt-0.5 mr-3 size-4 shrink-0 ${style.iconColor}`}
44+
/>
45+
<div>
46+
{announcement.message}
47+
{hasLink ? (
48+
<div className={tcls(linkStyles, style.link, 'ml-1 inline')}>
49+
{contentRef?.icon ? (
50+
<span className="mr-1 ml-2 *:inline">
51+
{contentRef?.icon}
52+
</span>
53+
) : null}
54+
{announcement.link?.title && (
55+
<span className="mr-1">{announcement.link?.title}</span>
56+
)}
57+
<Icon
58+
icon={
59+
announcement.link?.to.kind === 'url'
60+
? 'arrow-up-right'
61+
: 'chevron-right'
62+
}
63+
className={tcls('mb-0.5 inline size-3')}
64+
/>
65+
</div>
66+
) : null}
67+
</div>
68+
</Tag>
69+
{closeable ? (
70+
<button
71+
className={`absolute top-0 right-4 mt-2 mr-2 rounded straight-corners:rounded-none p-1.5 transition-all hover:ring-1 sm:right-6 md:right-8 ${style.close}`}
72+
type="button"
73+
onClick={dismissAnnouncement}
74+
>
75+
<Icon icon="close" className="size-4" />
76+
</button>
77+
) : null}
78+
</div>
7579
</div>
7680
</div>
7781
);

0 commit comments

Comments
 (0)