Skip to content

Commit

Permalink
style(go-banner, go-button): correct banner styles and icon button al…
Browse files Browse the repository at this point in the history
…ignment
  • Loading branch information
seanwuapps committed Dec 26, 2023
1 parent 63b3fbf commit 2639a84
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
16 changes: 10 additions & 6 deletions packages/core/src/components/go-banner/go-banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ go-banner {
/**
@prop --banner-padding-y:
Vertical padding of banner area
- default: 1.5rem
- default: 1rem
*/
--banner-padding-y: 1.5rem;
--banner-padding-y: 1rem;

/**
@prop --banner-heading-gap
Expand Down Expand Up @@ -100,8 +100,13 @@ go-banner {
display: flex;
align-items: center;
}
.banner-content {
.banner-inner {
display: flex;
width: 100%;
padding: var(--banner-padding-y) var(--banner-padding-x);
}
.banner-inner-content {
flex: 1;
h2 {
margin-bottom: var(--banner-heading-gap);
}
Expand All @@ -112,8 +117,7 @@ go-banner {
margin-bottom: 0;
}
}
.dismissible-col {
padding-top: var(--banner-padding-y);
padding-right: var(--banner-padding-x);
.banner-inner-dismiss {
margin-inline-start: auto;
}
}
58 changes: 36 additions & 22 deletions packages/core/src/components/go-banner/go-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,49 @@ export class GoBanner {
render() {
const { hasIcon, heading, dismissible, isShowing } = this;
return (
<Host class={{ 'has-icon': hasIcon, dismissible, 'is-showing': isShowing }}>
<Host
class={{
'has-icon': hasIcon,
dismissible,
'is-showing': isShowing,
'no-heading': !heading,
}}>
{hasIcon ? (
<div class="icon-col">
<slot name="icon"></slot>
</div>
) : null}

<section class="banner-content">
{heading ? <h2 class="h5">{heading}</h2> : null}
<slot></slot>
</section>
{dismissible ? (
<div class="dismissible-col">
<go-button variant="text" class="dismissible-btn" flat={true} icon={true} onClick={() => this.handleClose()} round={true}>
<span class="visually-hidden">Dismiss</span>
<svg
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
viewBox="0 0 24 24">
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</go-button>
<section class="banner-inner">
<div class="banner-inner-content">
{heading ? <h2 class="h5">{heading}</h2> : null}
<slot></slot>
</div>
) : null}
{dismissible ? (
<div class="banner-inner-dismiss">
<go-button
variant="text"
icon
class="dismissible-btn"
flat={true}
onClick={() => this.handleClose()}
round={true}>
<span class="visually-hidden">Dismiss</span>
<svg
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
viewBox="0 0 24 24">
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</go-button>
</div>
) : null}
</section>
</Host>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/go-button/go-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ go-button {
height: var(--go-btn-icon-size);
padding: 0;
text-align: center;
line-height: 1;
}
}

Expand Down

0 comments on commit 2639a84

Please sign in to comment.