Skip to content

Commit

Permalink
Tweaks to global header and stories
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Feb 9, 2024
1 parent 69aaf6e commit a6eb74a
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 50 deletions.
62 changes: 41 additions & 21 deletions src/nationalarchives/components/global-header/global-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@

@include colour.contrast;

background: linear-gradient(
0deg,
rgb(34 34 34 / 100%) 0%,
rgb(0 0 0 / 100%) 100%
);
.tna-template--light-theme & {
background: linear-gradient(
0deg,
rgb(34 34 34 / 100%) 0%,
rgb(0 0 0 / 100%) 100%
);
}

.tna-template--system-theme {
@media (prefers-color-scheme: light) {
background: linear-gradient(
0deg,
rgb(34 34 34 / 100%) 0%,
rgb(0 0 0 / 100%) 100%
);
}
}

&__main {
padding-bottom: 1.5rem;
Expand Down Expand Up @@ -55,6 +67,8 @@
}

&__logo-strapline {
padding-right: 0.625rem;

@include typography.heading-font;
@include typography.relative-font-size(20);
text-transform: uppercase;
Expand All @@ -73,8 +87,6 @@

@include colour.colour-background("font-dark");

// transition: height 1ms 100ms;

&::before,
&::after {
height: 0.25rem;
Expand All @@ -87,11 +99,6 @@

background-color: inherit;

// transition:
// top 100ms 100ms,
// bottom 100ms 100ms,
// transform 100ms;

content: "";
}

Expand Down Expand Up @@ -154,13 +161,11 @@
}

&__navigation-item {
// display: flex;
// align-items: center;

break-inside: avoid;
}

&__navigation-item-link {
min-width: 20vw;
height: math.div(6.75rem, 3);

display: block;
Expand Down Expand Up @@ -257,7 +262,6 @@
@include media.on-mobile {
&__main {
padding-bottom: 0;
// padding-bottom: 0;
}

&__logo-wrapper,
Expand Down Expand Up @@ -291,7 +295,7 @@

columns: 1;

background-color: rgb(255 255 255/5%);
background-color: rgb(255 255 255 / 10%);

@include colour.colour-border("keyline-dark", 3px, solid, top);
@include colour.colour-border("keyline-dark", 3px, solid, bottom);
Expand All @@ -300,16 +304,16 @@
&__navigation-item {
flex-direction: column;
align-items: flex-start;

&:last-child {
border-bottom: none;
}
}

&__navigation-item-link {
line-height: 1.75rem;
}

&__navigation-item:last-child &__navigation-item-link {
border-bottom: none;
}

&__navigation-item-contents {
display: block;
}
Expand Down Expand Up @@ -350,4 +354,20 @@
padding: 0.5rem gridVars.$gutter-width-tiny;
}
}

@include colour.on-high-contrast {
&__logo {
&:hover {
.tna-logo {
&__background {
fill: #fff;
}

&__foreground {
fill: #000;
}
}
}
}
}
}
137 changes: 121 additions & 16 deletions src/nationalarchives/components/global-header/global-header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,44 +45,44 @@ Standard.args = {
topNavigation: [
{
text: "Search",
href: "#/top-1",
href: "#/search",
icon: "search",
},
{
text: "Shop",
href: "#/top-2",
href: "#/shop",
icon: "bag-shopping",
},
{
text: "Sign in",
href: "#/top-3",
href: "#/sign-in",
icon: "user",
},
],
navigation: [
{
text: "Visit",
href: "#",
href: "#/visit",
},
{
text: "What's on",
href: "#",
href: "#/whats-on",
},
{
text: "Explore the collection",
href: "#",
href: "#/explore-the-collection",
},
{
text: "Using the archives",
href: "#",
href: "#/using-the-archives",
},
{
text: "Learn",
href: "#",
href: "#/learn",
},
{
text: "Professional guidance & services",
href: "#",
href: "#/professional-guidance-and-services",
},
],
classes: "tna-global-header--demo",
Expand All @@ -101,6 +101,79 @@ Standard.play = async ({ canvasElement }) => {
await expect($navigationToggle).not.toBeVisible();
};

export const Medium = Template.bind({});
Medium.parameters = {
viewport: {
defaultViewport: "medium",
},
chromatic: {
viewports: [customViewports["medium"].styles.width.replace(/px$/, "")],
},
};
Medium.args = {
logo: {
strapline: "Design System",
href: "#/",
},
topNavigation: [
{
text: "Search",
href: "#/search",
icon: "search",
},
{
text: "Shop",
href: "#/shop",
icon: "bag-shopping",
},
{
text: "Sign in",
href: "#/sign-in",
icon: "user",
},
],
navigation: [
{
text: "Visit",
href: "#/visit",
},
{
text: "What's on",
href: "#/whats-on",
},
{
text: "Explore the collection",
href: "#/explore-the-collection",
},
{
text: "Using the archives",
href: "#/using-the-archives",
},
{
text: "Learn",
href: "#/learn",
},
{
text: "Professional guidance & services",
href: "#/professional-guidance-and-services",
},
],
classes: "tna-global-header--demo",
};
Medium.play = async ({ canvasElement }) => {
await new Promise((r) => setTimeout(r, 100));

const $navigationItems = canvasElement.querySelector(
`.tna-global-header__navigation`,
);
const $navigationToggle = canvasElement.querySelector(
`.tna-global-header__navigation-button`,
);

await expect($navigationItems).toBeVisible();
await expect($navigationToggle).not.toBeVisible();
};

export const Mobile = Template.bind({});
Mobile.parameters = {
viewport: {
Expand All @@ -111,19 +184,51 @@ Mobile.parameters = {
},
};
Mobile.args = {
logo: {
strapline: "Design System",
href: "#/",
},
topNavigation: [
{
text: "Search",
href: "#/search",
icon: "search",
},
{
text: "Shop",
href: "#/shop",
icon: "bag-shopping",
},
{
text: "Sign in",
href: "#/sign-in",
icon: "user",
},
],
navigation: [
{
text: "Alpha",
href: "#/alpha",
selected: true,
text: "Visit",
href: "#/visit",
},
{
text: "What's on",
href: "#/whats-on",
},
{
text: "Beta",
href: "#/beta",
text: "Explore the collection",
href: "#/explore-the-collection",
},
{
text: "Gamma",
href: "#/gamma",
text: "Using the archives",
href: "#/using-the-archives",
},
{
text: "Learn",
href: "#/learn",
},
{
text: "Professional guidance & services",
href: "#/professional-guidance-and-services",
},
],
classes: "tna-global-header--demo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
padding-top: 0.5rem;
padding-bottom: 0.5rem;

border-bottom: 1px transparent solid;
@include typography.relative-font-size(16);

@include media.on-mobile {
@include typography.relative-font-size(16);
}
border-bottom: 1px transparent solid;

.tna-container {
align-items: center;
Expand Down
Loading

0 comments on commit a6eb74a

Please sign in to comment.