Skip to content

Commit

Permalink
feat: ASCOR layer
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Sep 27, 2023
1 parent daae0e9 commit ee225b3
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 55 deletions.
15 changes: 15 additions & 0 deletions app/assets/images/tpi/ascor/circles_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/assets/images/tpi/ascor/circles_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/tpi/ascor/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/assets/stylesheets/tpi/_nested-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,13 @@
color: $white;
}
}

&--ascor:not(.nested-dropdown--open) {
background: $ascor-background-color;

.nested-dropdown__title {
border: 1px solid $white;
color: $white;
}
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/tpi/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ $navbar-dropdown-item-hover-background-color: $blue;
$navbar-dropdown-item-active-color: white;
$navbar-dropdown-item-active-background-color: $blue;
$navbar-bottom-box-shadow-size: 0;
$ascor-background-color: #242638;

// TAGS
$tag-background-color: $white;
Expand Down
128 changes: 99 additions & 29 deletions app/assets/stylesheets/tpi/pages/ascor.scss
Original file line number Diff line number Diff line change
@@ -1,47 +1,117 @@
.ascor-page {
.ascor-header {
min-height: 100px;
display: flex;
align-items: center;
justify-content: space-between;
.dropdown-selector-wrapper {
position: relative;
background-color: $ascor-background-color;

&__assessment-dropdown {
display: flex;
flex-direction: column;
gap: 10px;
color: white;
.dropdown-selector__container {
background-color: $ascor-background-color;

@include tablet {
flex-direction: row;
align-items: center;
@include desktop {
padding: $container-top-padding $container-side-padding 40px $container-side-padding;
}
}

a {
color: white;
margin-right: 20px;
.dropdown-selector__container--active {
background-color: $white;
}

@include until($desktop) {
padding: 0 0.75rem;
font-size: $size-7;
height: 60px;
font-family: $font-family-regular;
.dropdown-selector__wrapper {
background-color: $ascor-background-color;
}
}

.dropdown-selector-wrapper {
background-color: $blue;

.dropdown-selector__container {
@include desktop {
padding: $container-top-padding $container-side-padding 40px $container-side-padding;
}
.dropdown-selector__active-button {
background-color: $dark;
}

@include desktop {
height: 335px;
}

.left-icon {
background-image: image-url('tpi/ascor/circles_1.svg');
width: 100%;
height: 100%;
background-repeat: no-repeat;
position: absolute;
background-position-y: 30px;
}

.right-icon {
background-image: image-url('tpi/ascor/circles_2.svg');
width: 100%;
height: 100%;
background-repeat: no-repeat;
position: absolute;
background-position-x: 100%;
}

.bottom-icon {
background-image: image-url('tpi/ascor/logo.png');
width: 100%;
height: 100%;
background-repeat: no-repeat;
position: absolute;
background-position: 50px 260px;
}

.ascor-header {
min-height: 100px;
display: flex;
align-items: center;
justify-content: flex-end;

&.show-version {
justify-content: space-between;

@include tablet {
padding-left: 20px;
}

@include desktop {
padding-left: calc((960px - 608px)/2);
}

@include widescreen {
padding-left: calc((1152px - 608px)/2);
}
}

&__assessment-dropdown {
display: flex;
flex-direction: column;
gap: 10px;
color: white;

@include tablet {
flex-direction: row;
align-items: center;
}
}

.button {
background-color: $ascor-background-color;
}

.button:hover {
background-color: $dark;
}

a {
color: white;
margin-right: 20px;
}

.links {
padding-right: 20px;
}

@include until($desktop) {
padding: 0 0.75rem;
font-size: $size-7;
height: 60px;
font-family: $font-family-regular;
}
}
}

section {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/tpi/RemoteDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function RemoteDropdown({ url, theme, params, data, selected, name }) {
window.Rails.fire(Select.current, 'change');
setLabel(item.label);
};
const chevron = !isOpen && theme === 'blue' ? chevronIconWhite : chevronIconBlack;
const chevron = !isOpen && (theme === 'blue' || theme === 'ascor') ? chevronIconWhite : chevronIconBlack;

return (
<>
Expand Down
21 changes: 1 addition & 20 deletions app/views/layouts/tpi/_banner.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,7 @@
/>
<% end %>
</div>
<div class="column is-offset-3 partners__container">
<p class="partners__title">Hosted by:</p>

<div class="partners">
<a href="http://www.lse.ac.uk/">
<img
src="<%= asset_path 'tpi/partners/lse.png' %>"
alt="The London School of Economics and Political Sciences"
class="partners__lse"
/>
</a>
<a href="http://www.lse.ac.uk/GranthamInstitute/">
<img
src="<%= asset_path 'tpi/partners/grantham.png' %>"
alt="Grantham Research Institute on Climate Change and the Environment"
class="partners__grantham"
/>
</a>
</div>
</div>
<%= content_for?(:hosted_by) ? content_for(:hosted_by) : render('layouts/tpi/hosted_by') %>
</div>
</div>
</div>
20 changes: 20 additions & 0 deletions app/views/layouts/tpi/_hosted_by.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="column is-offset-3 partners__container">
<p class="partners__title">Hosted by:</p>

<div class="partners">
<a href="http://www.lse.ac.uk/">
<img
src="<%= asset_path 'tpi/partners/lse.png' %>"
alt="The London School of Economics and Political Sciences"
class="partners__lse"
/>
</a>
<a href="http://www.lse.ac.uk/GranthamInstitute/">
<img
src="<%= asset_path 'tpi/partners/grantham.png' %>"
alt="Grantham Research Institute on Climate Change and the Environment"
class="partners__grantham"
/>
</a>
</div>
</div>
11 changes: 8 additions & 3 deletions app/views/tpi/ascor/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<% content_for :page_title, "ASCOR Tool - Transition Pathway Initiative" %>
<% content_for :hosted_by do %><span></span><% end %>

<div class="ascor-page">
<div class="dropdown-selector-wrapper">
<div class="left-icon"></div>
<div class="right-icon"></div>
<div class="bottom-icon"></div>

<!-- TODO: React component needs to be replaced!!! -->
<%= react_component("BankDropdown", { banks: @countries_json, selectedOption: 'All countries' }) %>

<div class="ascor-header container">
<div>
<div class="links">
<% if @methodology_publication.present? %>
<a href="#methodology" class="link with-icon is-pulled-left">
<a href="#methodology" class="link with-icon">
<img src="<%= asset_path 'icons/arrow-down.svg'%>" alt="arrow down" class="is-hidden-touch" />
Methodology
</a>
<% end %>
<a href="#publications" class="link with-icon is-pulled-left">
<a href="#publications" class="link with-icon">
<img src="<%= asset_path 'icons/arrow-down.svg'%>" alt="arrow down" class="is-hidden-touch" />
Publications
</a>
Expand Down
9 changes: 7 additions & 2 deletions app/views/tpi/ascor/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<% content_for :page_title, "#{@country.name} - Transition Pathway Initiative" %>
<% content_for :hosted_by do %><span></span><% end %>

<div class="ascor-page">
<div class="dropdown-selector-wrapper">
<div class="left-icon"></div>
<div class="right-icon"></div>
<div class="bottom-icon"></div>

<!-- TODO: React component needs to be replaced!!! -->
<%= react_component("BankDropdown", { banks: @countries_json, selectedOption: 'All countries' }) %>

<div class="ascor-header container">
<div class="ascor-header container show-version">
<div class="ascor-header__assessment-dropdown">
<div class="caption">
Assessment Date:
Expand All @@ -14,7 +19,7 @@
<%= react_component('RemoteDropdown', {
name: 'assessment_id',
remote: true,
theme: 'blue',
theme: 'ascor',
url: tpi_ascor_path(@country),
data: @country.assessments.map {|v| {label: v['assessment_date']&.strftime('%d %B %Y'), value: v['id']}},
selected: params[:assessment_id]
Expand Down

0 comments on commit ee225b3

Please sign in to comment.