Skip to content

Commit

Permalink
First pass of international home in great-cms (#2897)
Browse files Browse the repository at this point in the history
* First pass of international home in great-cms

* Styling updates

* Refactor styles

* Updating model test in EYB index cms page class

* Removing views and test_views as no longer used

* Adding test_models for international

* Adding test coverage to getting international icons on homepage
  • Loading branch information
stuart-mindt authored Feb 14, 2024
1 parent 59dc9d7 commit 2074154
Show file tree
Hide file tree
Showing 34 changed files with 1,050 additions and 74 deletions.
16 changes: 16 additions & 0 deletions core/static/images/uk-map.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions core/templatetags/content_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,24 @@ def get_icon_path(url):
return ''


@register.filter
def get_international_icon_path(url):
url_to_icon_list = (
('uk-investment-zones', 'Icon-investment-zones'),
('uk-tax-and-incentives', 'Icon-tax-and-incentives'),
('uk-talent-and-labour', 'Icon-talent-and-labour'),
('uk-infrastructure', 'Icon-infrastructure'),
('clean-growth-in-the-uk', 'Icon-clean-growth'),
('freeports-in-the-uk', 'Icon-freeports'),
('uk-innovation', 'Icon-innovation'),
('sectors', 'Icon-sectors'),
)
for url_to_icon in url_to_icon_list:
if url_to_icon[0] in url:
return 'international/includes/svg/' + url_to_icon[1] + '.svg'
return ''


@register.simple_tag
def render_automated_list_page_card_content(page, request, module_completion_data):
if request.user.is_authenticated and module_completion_data:
Expand Down
26 changes: 26 additions & 0 deletions international/cms_panels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from wagtail.admin.panels import FieldPanel, MultiFieldPanel


class GreatInternationalHomePagePanels:
content_panels = [
FieldPanel('title'),
MultiFieldPanel(
heading='Hero',
classname='collapsible',
children=[
FieldPanel('hero_image'),
FieldPanel('hero_mobile_image'),
FieldPanel('hero_text'),
FieldPanel('hero_subtitle'),
],
),
MultiFieldPanel(
heading='Digital Entry Point CTA',
classname='collapsible',
children=[
FieldPanel('dep_title'),
FieldPanel('dep_sub_title'),
FieldPanel('dep_cards'),
],
),
]
539 changes: 539 additions & 0 deletions international/migrations/0001_initial.py

Large diffs are not rendered by default.

Empty file.
58 changes: 58 additions & 0 deletions international/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from django.db import models
from wagtail.fields import StreamBlock, StreamField

from core.blocks import SupportTopicCardBlock
from domestic.models import BaseContentPage
from international import cms_panels


class GreatInternationalHomePage(cms_panels.GreatInternationalHomePagePanels, BaseContentPage):
# This is the main homepge for Great.gov.uk/international

parent_page_types = [
'domestic.GreatDomesticHomePage',
]

template = 'international/index.html'

# hero
hero_image = models.ForeignKey(
'core.AltTextImage',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
)

hero_mobile_image = models.ForeignKey(
'core.AltTextImage',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
)

hero_text = models.TextField(null=True, blank=True)
hero_subtitle = models.TextField(null=True, blank=True)

dep_title = models.TextField(null=True, blank=True)
dep_sub_title = models.TextField(null=True, blank=True)

dep_cards = StreamField(
[
(
'cards',
StreamBlock(
[
('topic_card', SupportTopicCardBlock()),
],
block_counts={
'topic_card': {'min_num': 1},
},
),
),
],
use_json_field=True,
null=True,
blank=True,
)
74 changes: 74 additions & 0 deletions international/sass/hero.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Hero banner

.great-hero {
position: relative;
padding-top: 0;
padding-bottom: 0;
background-repeat: no-repeat;
background-size: cover;
background-position: center;


& > .container {
min-height: 200px;
overflow: visible;
padding-top: 45px;
}

.great-hero-no-image {
background-color: $eyb-dark-blue;
}

.great-hero__container {
@include govuk-media-query($from: desktop) {
display: flex;
}
}

.great-hero__text {
max-width: 50%;
min-height: 335px;
display: flex;
flex-direction: column;
justify-content: end;
padding-bottom: 5px;
align-items: flex-start;

.great-hero-heading {
color: white;
font-size: 32px;
}

.great-hero-subheading {
color: white;
font-size: 18px;
margin-bottom: 0px;
}

.great-hero-description {
margin-bottom: 0;
}

}

@media (min-width: 641px) {
.great-hero__text {
min-height: 560px;
max-width: 567px;
justify-content: center;

.great-hero-heading {
font-size: 60px;
}

.great-hero-subheading {
font-size: 24px;
margin-bottom: 0px;
}
}
}
}

.great-hero-cards {
background: linear-gradient(270deg, #02022D 0%, #020130 100%);
}
37 changes: 26 additions & 11 deletions international/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,38 @@ ul {
@import 'header.scss';
@import 'footer.scss';
@import '../../styles/great/utils';
@import '../../styles/great/components';
@import 'hero.scss';


body {
margin: 0;
}

.great-hero {
background-image: url('/static/images/international-background-image.png');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
border-radius: var(--spacing-spacing-0, 0px);
flex-direction: column;
gap: 20px;

align-self: stretch;
// International home page styles start
.why-choose-uk-section {
background-color: #eef2f6;
}

.great-hero__heading {
color: white;
.international-card--cta {
div {
font-family: 'Euclid Flex B';
}
.great-card__link {
font-family: 'Euclid Flex B';
color: #04043F;
text-underline-offset: 3px;
text-decoration-thickness: 3px;
}
}

.international-home-uk-map {
background: url('/static/images/uk-map.svg');
display: block;
width: fixed;
height: 387px;
background-repeat: no-repeat;
background-size: contain;
}
// International home page styles end
42 changes: 42 additions & 0 deletions international/templates/international/components/landing_hero.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% load wagtailimages_tags %}
{% load static %}
{% image hero_image original as rendition %}
{% image page.hero_mobile_image original as mobile_image %}
<style>
.great-hero {
background-image: url({{ mobile_image.url }});
}

@media (min-width: 641px) {
.great-hero {
background-image: url({{ rendition.url }});
}
}
</style>
<section class="great-hero {% if not hero_image %}great-hero-no-image{% endif %}"
id="hero">
<div class="govuk-width-container">
<div class="great-hero__container govuk-grid-row">
<div class="great-hero__text govuk-grid-column-one-half">
<h1 class="govuk-heading-l great-hero-heading">{{ heading }}</h1>
<p class="govuk-body-m great-hero-subheading">{{ subtitle }}</p>
</div>
<div class="govuk-grid-column-one-half"></div>
</div>
</div>
</section>
<section class="great-hero-cards govuk-!-padding-top-3">
<div class="govuk-width-container">
<div class="govuk-grid-row great-card-row govuk-!-padding-bottom-9">
<div class="govuk-grid-column-one-third">
{% include 'components/great/card.html' with content="We can guide you every step of the way, to set up and grow your business in the UK" title="How to expand your business" url="/international/expand-your-business-in-the-uk/" show_title_link=True heading_class="govuk-heading-m" classes="international-card--cta" %}
</div>
<div class="govuk-grid-column-one-third">
{% include 'components/great/card.html' with content="Explore a range of property development and infrastructure projects to suit your investment" title="Find investment opportunities" url="/international/investment/" show_title_link=True heading_class="govuk-heading-m" classes="international-card--cta" %}
</div>
<div class="govuk-grid-column-one-third">
{% include 'components/great/card.html' with content="Get introduced to UK businesses who can partner with your business to achieve success" title="Buy UK products and services" url="/international/content/trade/how-we-help-you-buy/" show_title_link=True heading_class="govuk-heading-m" classes="international-card--cta" %}
</div>
</div>
</div>
</section>
8 changes: 4 additions & 4 deletions international/templates/international/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<a href="{% if not eyb_user %}{% url 'international_online_offer:index' %}{% else %}/international/expand-your-business-in-the-uk/guide/{% endif %}"
class="govuk-header__link govuk-header__service-name">Expand your business in the UK</a>
{% else %}
<nav aria-label="Menu" class="govuk-header__navigation">
<nav class="govuk-header__navigation" aria-label="Main menu">
<button type="button"
class="govuk-header__menu-button govuk-js-header-toggle"
aria-controls="navigation"
aria-label="Show or hide menu"
hidden>Menu</button>
<ul id="navigation"
<ul id="primary-navigation"
class="govuk-header__navigation-list great-navigation-list">
<li class="govuk-header__navigation-item {% if '/expand-your-business-in-the-uk/' in request.path %}govuk-header__navigation-item--active{% endif %}">
<a class="govuk-header__link govuk-link--inverse govuk-!-font-size-19"
Expand Down Expand Up @@ -55,13 +55,13 @@
<div class="govuk-header__container govuk-width-container">
<div class="govuk-header__logo international-sub-navigation-logo"></div>
<div class="govuk-header__content">
<nav aria-label="Menu" class="govuk-header__navigation">
<nav class="govuk-header__navigation" aria-label="Section menu">
<button type="button"
class="govuk-header__menu-button govuk-js-header-toggle"
aria-controls="navigation"
aria-label="Show or hide menu"
hidden>Menu</button>
<ul id="navigation"
<ul id="secondary-navigation"
class="govuk-header__navigation-list great-navigation-list govuk-!-padding-bottom-1 govuk-!-padding-top-1">
{% if eyb_user %}
<li class="govuk-header__navigation-item {% if '/expand-your-business-in-the-uk/guide' in request.path %}govuk-header__navigation-item--active{% endif %}">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2074154

Please sign in to comment.