-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add authority logos at bottom of results (#22)
## Description This isn't 100% exactly as designed. The design calls for a white background that extends horizontally beyond the borders of the incentive grid. That doesn't work with how this embed element is implemented: it just fills 100% of the width of its container, so nothing can extend beyond the grid boundaries. Not sure if what I've done is an acceptable end state, or if we need to build in a way to limit the width of the incentive grid without limiting the width of the logos background. ## Test Plan See screenshot. Try with different utility selections to make sure their logos come up. Check narrow and medium layouts to check for appropriate layout.
- Loading branch information
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { css, html, nothing } from 'lit'; | ||
import { APIResponse } from './api/calculator-types-v1'; | ||
|
||
export const authorityLogosStyles = css` | ||
.authority-logos { | ||
width: 100%; | ||
max-width: 1280px; | ||
background-color: white; | ||
} | ||
.authority-logos h2 { | ||
text-align: center; | ||
color: #111; | ||
font-size: 2rem; | ||
font-weight: 500; | ||
line-height: 125%; | ||
margin: 48px 24px 64px 24px; | ||
} | ||
/* Tighter margins for the header on small screens */ | ||
@media only screen and (max-width: 640px) { | ||
.authority-logos h2 { | ||
font-size: 1.5rem; | ||
margin-top: 32px; | ||
margin-bottom: 48px; | ||
} | ||
} | ||
.authority-logos__container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: flex-start; | ||
gap: 64px; | ||
margin-bottom: 80px; | ||
} | ||
`; | ||
|
||
/** | ||
* Displays the white area at the bottom of the calculator results with logos | ||
* of the authorities whose incentives are displayed. | ||
*/ | ||
export const authorityLogosTemplate = (response: APIResponse) => { | ||
if (Object.keys(response.authorities).length === 0) { | ||
return nothing; | ||
} | ||
|
||
const logos = Object.values(response.authorities) | ||
.filter(auth => !!auth.logo) | ||
.map( | ||
auth => | ||
html`<img | ||
src="${auth.logo!.src}" | ||
width="${auth.logo!.width}" | ||
height="${auth.logo!.height}" | ||
/>`, | ||
); | ||
|
||
return html` | ||
<div class="authority-logos"> | ||
<h2>Incentive data brought to you by</h2> | ||
<div class="authority-logos__container">${logos}</div> | ||
</div> | ||
`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
488b31f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
embed-rewiringamerica-org – ./
embed-rewiringamerica-org-git-main-rewiring-america.vercel.app
embed.rewiringamerica.org
embed-rewiringamerica-org-rewiring-america.vercel.app
embed-rewiringamerica-org.vercel.app