Skip to content

Commit

Permalink
Add top border to cards without images (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood authored Mar 8, 2024
1 parent 1928838 commit eaef110
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The default pagination style is plain buttons but can be changed with the `solid` option
- Added some attributes to the HTML of the headers to reduce reliance on the JavaScript
- Cards without images now get a top border

### Deprecated
### Removed
Expand Down
3 changes: 1 addition & 2 deletions src/nationalarchives/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

@include colour.colour-background("button-background");

@include colour.colour-border("button-background", 0.25rem);
// border-radius: 0.1px;
@include colour.colour-border("button-background", 4px);

cursor: pointer;

Expand Down
6 changes: 6 additions & 0 deletions src/nationalarchives/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@
}
}

&__inner:has(&__heading + &__body) {
padding-top: 0.5rem;

@include colour.thick-keyline-dark(top);
}

@include colour.on-high-contrast-and-forced-colours {
@include colour.colour-border("keyline-dark", 1px);

Expand Down
11 changes: 11 additions & 0 deletions src/nationalarchives/components/card/card.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ Accent.args = {
classes: "tna-card--demo",
};

export const NoImage = Template.bind({});
NoImage.args = {
title: "Card title",
headingLevel: 3,
headingSize: "s",
href: "#",
body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis.</p>",
htmlElement: "article",
classes: "tna-card--demo",
};

export const Horizontal = Template.bind({});
Horizontal.args = {
supertitle: "Card supertitle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@include colour.colour-background("page-background");

@include colour.colour-border("form-error", 0.25rem, solid);
@include colour.colour-border("form-error", 0.3125rem, solid);

&:focus {
outline: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

list-style: none;

@include colour.colour-border("accent-background", 0.375rem, solid, top);
@include colour.thick-keyline-accent(top);

&__item {
padding: 2rem;
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
&__navigation {
&-block {
&-items {
@include colour.colour-border("keyline-dark", 0.25rem, solid, top);
@include colour.colour-border("keyline-dark", 4px, solid, top);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@

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);
@include colour.colour-border("keyline-dark", 2px, solid, top);
@include colour.colour-border("keyline-dark", 2px, solid, bottom);
}

&__navigation-item {
Expand Down
4 changes: 2 additions & 2 deletions src/nationalarchives/components/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@

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);
@include colour.colour-border("keyline-dark", 2px, solid, top);
@include colour.colour-border("keyline-dark", 2px, solid, bottom);
}

&__navigation-item {
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/hero/hero.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

@include colour.accent;

@include colour.colour-border("background", 0.25rem);
@include colour.colour-border("background", 4px);
border-radius: 100%;

cursor: pointer;
Expand Down
5 changes: 2 additions & 3 deletions src/nationalarchives/components/message/message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@

@include colour.accent-light;

background-color: colour.brand-colour("cream");
@include colour.colour-background-brand("cream");

@include colour.colour-border("keyline-dark", 0.5rem, solid, left);
border-left-color: colour.brand-colour("yellow");
@include colour.thick-keyline-brand(left, "yellow");

@include media.on-tiny {
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/skip-link/skip-link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
&:focus {
@include colour.colour-background("button-background", $important: true);

@include colour.colour-border("focus-outline", 0.3125rem, $important: true);
@include colour.colour-border("focus-outline", 5px, $important: true);

outline: none !important;
}
Expand Down
24 changes: 24 additions & 0 deletions src/nationalarchives/tools/_colour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
background-color: var(--#{$colour}) if($important, !important, null);
}

@mixin colour-background-brand($brandColour, $important: false) {
background-color: #{brand-colour($brandColour)} if($important, !important, null);
}

@mixin colour-border(
$colour,
$width: "",
Expand Down Expand Up @@ -159,6 +163,26 @@
fill: var(--#{$colour}) if($important, !important, null);
}

@mixin thick-keyline($direction) {
@include colour-border("keyline", 5px, solid, $direction);
}

@mixin thick-keyline-dark($direction) {
@include colour-border("keyline-dark", 5px, solid, $direction);
}

@mixin thick-keyline-accent($direction) {
@include colour-border("accent-background", 5px, solid, $direction);
}

@mixin thick-keyline-error($direction) {
@include colour-border("form-error", 5px, solid, $direction);
}

@mixin thick-keyline-brand($direction, $brandColour) {
border-#{$direction}: 5px #{brand-colour($brandColour)} solid;
}

%light {
@include colour-css-vars("form-error");

Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/utilities/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ select {
&--error {
padding-left: 1rem;

@include colour.colour-border("form-error", 0.25rem, solid, left);
@include colour.thick-keyline-error(left);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/utilities/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}

&__head &__header {
@include colour.colour-border("keyline-dark", 0.25rem, solid, bottom);
@include colour.colour-border("keyline-dark", 4px, solid, bottom);
}

p {
Expand Down
4 changes: 2 additions & 2 deletions src/nationalarchives/utilities/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ small {
%chip-accent {
@include colour.accent;

@include colour.colour-border("accent-background", 0.125rem);
@include colour.colour-border("accent-background", 2px);

.tna-background-accent & {
@include colour.contrast;
Expand Down Expand Up @@ -363,7 +363,7 @@ small {
margin-left: 0;
padding: 1rem 1rem 1rem 2rem;

@include colour.colour-border("accent-background", 0.375rem, solid, left);
@include colour.thick-keyline-accent(left);

&__quote {
font-weight: 700;
Expand Down

0 comments on commit eaef110

Please sign in to comment.