Skip to content

Commit

Permalink
Merge df426f9 into 13a6f0d
Browse files Browse the repository at this point in the history
  • Loading branch information
Pamela Bortnick committed Oct 6, 2022
2 parents 13a6f0d + df426f9 commit e3393f2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-news-cough.md
@@ -0,0 +1,5 @@
---
"@hashicorp/react-subnav": patch
---

Ensure subnav link items are centered when there is no overflow
10 changes: 10 additions & 0 deletions packages/subnav/docs.mdx
Expand Up @@ -18,6 +18,16 @@ Displays a navigation bar, with links and a call-to-action. Links can be organiz
/>`}
</LiveComponent>

## Without CTA:
<Subnav
titleLink={{ text: 'Title', url: '#' }}
menuItems={[
{ text: 'Link One', url: '#'},
{ text: 'Link Two', url: '#'},
{ text: 'Link Three', url: '#'}
]}
/>

<UsageDetails packageJson={packageJson} />

### Props
Expand Down
1 change: 1 addition & 0 deletions packages/subnav/index.js
Expand Up @@ -70,6 +70,7 @@ function SubnavInner({
<div
className={classNames(s.subnavInner, themeClass, {
[s.notConstrained]: !constrainWidth,
[s.hasOverflow]: hasOverflow,
})}
data-overflow-target
>
Expand Down
2 changes: 1 addition & 1 deletion packages/subnav/partials/CtaLinks/style.module.css
@@ -1,7 +1,7 @@
.root {
align-items: center;
display: flex;
justify-content: center;
justify-content: flex-end;
white-space: nowrap;

& > * + * {
Expand Down
7 changes: 6 additions & 1 deletion packages/subnav/style.module.css
Expand Up @@ -36,10 +36,15 @@
}

.subnavInner {
display: flex;
display: grid;
grid-template-columns: 1fr 2fr 1fr;
align-items: center;
height: 62px;

&.hasOverflow {
display: flex;
}

&.notConstrained {
padding: 0 24px;

Expand Down

0 comments on commit e3393f2

Please sign in to comment.