Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/design system #352

Merged
merged 7 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions django_app/frontend/iai-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions django_app/frontend/iai-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# i.AI Design System

This is a light-weight wrapper to go over the top of the gov.uk design system, adding styles for i.AI services.

## Installation

1. Import the `iai.scss` file

2. Add the i.AI logo to govuk-assets folder (or other appropriate folder for serving static files)

3. In the footer, replace:

```
<a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"> © Crown copyright</a>
```

With:

```
<a class="govuk-footer__link govuk-footer__copyright-logo" href="https://ai.gov.uk">
<img src="/static/govuk-assets/i-dot-ai-Official-Logo.svg" alt="Incubator for Artificial Intelligence" loading="lazy"/>
</a>
```

## Optional styles and components

## Brand colour

The default brand colour is the i.AI pink. It is possible to change this by updating the `--product-colour` css variable at the top of the `iai.scss` file.

### Phase banner

Instead of using the standard phase banner, it is possible to add this to the header.

Replace:

```
<a href="/" class="govuk-header__link govuk-header__service-name">Service name</a>
```

With:

```
<div class="iai-header__service-name-container">
<a href="/" class="govuk-header__link govuk-header__service-name">Service name</a>
<strong class="govuk-tag govuk-phase-banner__content__tag">Beta</strong>
</div>
```

You may also wish to add a feedback link to the footer. Using the example at https://design-system.service.gov.uk/components/footer/#footer-with-links-and-secondary-navigation replace "Built by the Government Digital Service" with "This is a new service – your feedback will help us to improve it.".
103 changes: 103 additions & 0 deletions django_app/frontend/iai.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* GENERAL */
:root {
--product-colour: #A50202;
--border-radius: 0.5rem;
}
.govuk-main-wrapper {
padding: 2rem 0;
}

/* HEADER */
.govuk-header {
border-bottom: 0;
}
.govuk-header__container {
border-bottom: 0;
margin-bottom: 0;
padding-bottom: 0.625rem;
padding-top: 0.5rem;
}
.govuk-header__logo {
display: none;
}
.govuk-header__content {
padding-left: 0;
width: 100%;
}
.iai-header__service-name-container {
align-items: center;
display: flex;
gap: 0.75rem;
}
.govuk-header__service-name {
margin-bottom: 0;
}
.govuk-header__navigation {
margin-bottom: 0;
}
.govuk-header__navigation-list {
margin-top: 0.75rem;
}
@media (min-width: 769px) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks different from how GDS do media queries. Is this ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good flag @wpfl-dbt. Usually the GDS approach would be better, but as this CSS could also be used outside of Sass I'd suggest this is okay here.

.govuk-header__content {
align-items: center;
display: flex;
justify-content: space-between;
}
.govuk-header__navigation-list {
margin-top: 0;
}
}

/* BUTTON */
.govuk-button {
border: 0;
border-radius: var(--border-radius);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a vague memory that Firefox needs a different solution for border-radius -- does this needs belt and bracing? Or have times a-changed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is this kind of thing literally why we use Sass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox should play nicely with border-radius nowadays :-)
Sass doesn't really add anything in this context. I'm building it in a way so it doesn't rely on Sass (even though it's a .scss file) for compatibility across projects.

box-shadow: none;
padding: 13px 12px 12px 12px;
}

/* FOOTER */
.govuk-footer {
padding-top: 1.75rem;
}
.govuk-footer__meta-item {
margin-bottom: 0;
}
.govuk-footer__copyright-logo {
background-image: none;
padding-top: 0.5rem;
}
.govuk-footer__copyright-logo img {
filter: grayscale(1);
height: 5.25rem;
width: 7rem;
}

/* LINKS */
.govuk-link:visited {
color: inherit;
}

/* NOTIFICATION BANNER */
.govuk-notification-banner {
border-radius: var(--border-radius);
}
.govuk-notification-banner__content {
border-bottom-right-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}

/* PHASE BANNER */
.govuk-phase-banner__content__tag {
background-color: var(--product-colour);
font-weight: 700;
margin-top: -4px;
padding-top: 4px;
text-transform: uppercase;
}

/* INPUT, TEXTAREA */
.govuk-input, .govuk-textarea {
border-radius: var(--border-radius);
}
4 changes: 4 additions & 0 deletions django_app/frontend/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SASS Compilation (if not using django-compressor)

`npm install -g sass`
`sass style.scss style.css -w`
151 changes: 149 additions & 2 deletions django_app/frontend/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion django_app/frontend/style.css.map

Large diffs are not rendered by default.

Loading
Loading