Compare commits

...

17 Commits

Author SHA1 Message Date
efim b0dd8cded1 feat: docker image for results component 2023-10-04 10:39:33 +00:00
efim f48d958a2c feat: passing of the port as arg 2023-10-04 09:25:13 +00:00
efim 2cb3cc7c35 feat: split results into insertable component
still not fully sure how this all operates, but allright.
2023-10-04 09:13:12 +00:00
efim f4ab1ac7ec feat: other fields taken from template data 2023-10-04 08:38:31 +00:00
efim 2769f5e8dc feat: desktop styling 2023-10-04 08:28:02 +00:00
efim d7dce88751 feat: icons added via <img> by static path 2023-10-04 06:23:34 +00:00
efim b036002ca8 feat: repeating category in template 2023-10-04 06:03:04 +00:00
efim 70ab1e59c4 feat: button styled 2023-10-04 05:20:55 +00:00
efim 133fa0df2b feat: colors for items via css variable 2023-10-04 05:16:52 +00:00
efim 58ca4ecafa feat: upper part styled 2023-10-03 18:13:16 +00:00
efim 843e55841b fix: fontFamily override name 2023-10-03 17:56:40 +00:00
efim cfe3994bc9 feat: style guilde fonts enabled 2023-10-03 16:48:45 +00:00
efim 8b95d963fe feat: enabled tailwindcss
and have single watcher command to rebuild out.css and restart the
server:
wgo -verbose -file .go -file .gohtml echo reloading :: bash -c 'tailwindcss -i ./input.css -o public/out.css' :: go run main.go
2023-10-03 15:06:18 +00:00
efim 83d8cd07d2 init: adding frontendmentor task resources 2023-10-03 14:27:38 +00:00
efim 6b323ba746 feat: embedding templates as well
maybe it's possible to somehow limit file server to a directory
2023-10-03 14:12:20 +00:00
efim e834ff06ab feat: responding with a basic template 2023-10-03 13:52:01 +00:00
efim f30d9dad94 init: 17 - simple page with go ssr 2023-10-03 10:15:07 +00:00
32 changed files with 1552 additions and 1 deletions

0
.go/pkg/mod/cache/lock vendored Normal file
View File

View File

@ -0,0 +1,16 @@
# Avoid accidental upload of the Sketch and Figma design files
#####################################################
## Please do not remove lines 5 and 6 - thanks! 🙂 ##
#####################################################
*.sketch
*.fig
# Avoid accidental XD upload if you convert the design file
###############################################
## Please do not remove line 12 - thanks! 🙂 ##
###############################################
*.xd
# Avoid your project being littered with annoying .DS_Store files!
.DS_Store
.prettierignore

View File

View File

@ -0,0 +1,119 @@
# Frontend Mentor - Results summary component solution
This is a solution to the [Results summary component challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/results-summary-component-CE_K6s0maV). Frontend Mentor challenges help you improve your coding skills by building realistic projects.
## Table of contents
- [Overview](#overview)
- [The challenge](#the-challenge)
- [Screenshot](#screenshot)
- [Links](#links)
- [My process](#my-process)
- [Built with](#built-with)
- [What I learned](#what-i-learned)
- [Continued development](#continued-development)
- [Useful resources](#useful-resources)
- [Author](#author)
- [Acknowledgments](#acknowledgments)
**Note: Delete this note and update the table of contents based on what sections you keep.**
## Overview
### The challenge
Users should be able to:
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- **Bonus**: Use the local JSON data to dynamically populate the content
### Screenshot
![](./screenshot.jpg)
Add a screenshot of your solution. The easiest way to do this is to use Firefox to view your project, right-click the page and select "Take a Screenshot". You can choose either a full-height screenshot or a cropped one based on how long the page is. If it's very long, it might be best to crop it.
Alternatively, you can use a tool like [FireShot](https://getfireshot.com/) to take the screenshot. FireShot has a free option, so you don't need to purchase it.
Then crop/optimize/edit your image however you like, add it to your project, and update the file path in the image above.
**Note: Delete this note and the paragraphs above when you add your screenshot. If you prefer not to add a screenshot, feel free to remove this entire section.**
### Links
- Solution URL: [Add solution URL here](https://your-solution-url.com)
- Live Site URL: [Add live site URL here](https://your-live-site-url.com)
## My process
### Built with
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- [React](https://reactjs.org/) - JS library
- [Next.js](https://nextjs.org/) - React framework
- [Styled Components](https://styled-components.com/) - For styles
**Note: These are just examples. Delete this note and replace the list above with your own choices**
### What I learned
#### restarting server of file watch
wgo -verbose -file .go -file .gohtml -file tailwind.config.js echo reloading :: bash -c 'tailwindcss -i ./input.css -o public/out.css' :: go run main.go
and doing tailwind first, because server embeds the output css file, so it's needed for the build step
#### sample
Use this section to recap over some of your major learnings while working through this project. Writing these out and providing code samples of areas you want to highlight is a great way to reinforce your own knowledge.
To see how you can add code snippets, see below:
```html
<h1>Some HTML code I'm proud of</h1>
```
```css
.proud-of-this-css {
color: papayawhip;
}
```
```js
const proudOfThisFunc = () => {
console.log('🎉')
}
```
If you want more help with writing markdown, we'd recommend checking out [The Markdown Guide](https://www.markdownguide.org/) to learn more.
**Note: Delete this note and the content within this section and replace with your own learnings.**
### Continued development
Use this section to outline areas that you want to continue focusing on in future projects. These could be concepts you're still not completely comfortable with or techniques you found useful that you want to refine and perfect.
**Note: Delete this note and the content within this section and replace with your own plans for continued development.**
### Useful resources
- [Example resource 1](https://www.example.com) - This helped me for XYZ reason. I really liked this pattern and will use it going forward.
- [Example resource 2](https://www.example.com) - This is an amazing article which helped me finally understand XYZ. I'd recommend it to anyone still learning this concept.
**Note: Delete this note and replace the list above with resources that helped you during the challenge. These could come in handy for anyone viewing your solution or for yourself when you look back on this project in the future.**
## Author
- Website - [Add your name here](https://www.your-site.com)
- Frontend Mentor - [@yourusername](https://www.frontendmentor.io/profile/yourusername)
- Twitter - [@yourusername](https://www.twitter.com/yourusername)
**Note: Delete this note and add/remove/edit lines above based on what links you'd like to share.**
## Acknowledgments
This is where you can give a hat tip to anyone who helped you out on this project. Perhaps you worked in a team or got some inspiration from someone else's solution. This is the perfect place to give them some credit.
**Note: Delete this note and edit this section's content as necessary. If you completed this challenge by yourself, feel free to delete this section entirely.**

View File

@ -0,0 +1,97 @@
# Frontend Mentor - Results summary component
![Design preview for the Results summary component coding challenge](./design/desktop-preview.jpg)
## Welcome! 👋
Thanks for checking out this front-end coding challenge.
[Frontend Mentor](https://www.frontendmentor.io) challenges help you improve your coding skills by building realistic projects.
**To do this challenge, you need a basic understanding of HTML and CSS.**
## The challenge
Your challenge is to build out this results summary component and get it looking as close to the design as possible.
You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go.
We provide the data for the results in a local `data.json` file. So you can use that to add the results and total score dynamically if you choose.
Your users should be able to:
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- **Bonus**: Use the local JSON data to dynamically populate the content
Want some support on the challenge? [Join our Slack community](https://www.frontendmentor.io/slack) and ask questions in the **#help** channel.
## Where to find everything
Your task is to build out the project to the designs inside the `/design` folder. You will find both a mobile and a desktop version of the design.
The designs are in JPG static format. Using JPGs will mean that you'll need to use your best judgment for styles such as `font-size`, `padding` and `margin`.
If you would like the design files (we provide Sketch & Figma versions) to inspect the design in more detail, you can [subscribe as a PRO member](https://www.frontendmentor.io/pro).
All the required assets for this project are in the `/assets` folder. The images are already exported for the correct screen size and optimized.
We also include variable and static font files for the required fonts for this project. You can choose to either link to Google Fonts or use the local font files to host the fonts yourself. Note that we've removed the static font files for the font weights that aren't needed for this project.
There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts.
## Building your project
Feel free to use any workflow that you feel comfortable with. Below is a suggested process, but do not feel like you need to follow these steps:
1. Initialize your project as a public repository on [GitHub](https://github.com/). Creating a repo will make it easier to share your code with the community if you need help. If you're not sure how to do this, [have a read-through of this Try Git resource](https://try.github.io/).
2. Configure your repository to publish your code to a web address. This will also be useful if you need some help during a challenge as you can share the URL for your project with your repo URL. There are a number of ways to do this, and we provide some recommendations below.
3. Look through the designs to start planning out how you'll tackle the project. This step is crucial to help you think ahead for CSS classes to create reusable styles.
4. Before adding any styles, structure your content with HTML. Writing your HTML first can help focus your attention on creating well-structured content.
5. Write out the base styles for your project, including general content styles, such as `font-family` and `font-size`.
6. Start adding styles to the top of the page and work down. Only move on to the next section once you're happy you've completed the area you're working on.
## Deploying your project
As mentioned above, there are many ways to host your project for free. Our recommend hosts are:
- [GitHub Pages](https://pages.github.com/)
- [Vercel](https://vercel.com/)
- [Netlify](https://www.netlify.com/)
You can host your site using one of these solutions or any of our other trusted providers. [Read more about our recommended and trusted hosts](https://medium.com/frontend-mentor/frontend-mentor-trusted-hosting-providers-bf000dfebe).
## Create a custom `README.md`
We strongly recommend overwriting this `README.md` with a custom one. We've provided a template inside the [`README-template.md`](./README-template.md) file in this starter code.
The template provides a guide for what to add. A custom `README` will help you explain your project and reflect on your learnings. Please feel free to edit our template as much as you like.
Once you've added your information to the template, delete this file and rename the `README-template.md` file to `README.md`. That will make it show up as your repository's README file.
## Submitting your solution
Submit your solution on the platform for the rest of the community to see. Follow our ["Complete guide to submitting solutions"](https://medium.com/frontend-mentor/a-complete-guide-to-submitting-solutions-on-frontend-mentor-ac6384162248) for tips on how to do this.
Remember, if you're looking for feedback on your solution, be sure to ask questions when submitting it. The more specific and detailed you are with your questions, the higher the chance you'll get valuable feedback from the community.
## Sharing your solution
There are multiple places you can share your solution:
1. Share your solution page in the **#finished-projects** channel of the [Slack community](https://www.frontendmentor.io/slack).
2. Tweet [@frontendmentor](https://twitter.com/frontendmentor) and mention **@frontendmentor**, including the repo and live URLs in the tweet. We'd love to take a look at what you've built and help share it around.
3. Share your solution on other social channels like LinkedIn.
4. Blog about your experience building your project. Writing about your workflow, technical choices, and talking through your code is a brilliant way to reinforce what you've learned. Great platforms to write on are [dev.to](https://dev.to/), [Hashnode](https://hashnode.com/), and [CodeNewbie](https://community.codenewbie.org/).
We provide templates to help you share your solution once you've submitted it on the platform. Please do edit them and include specific questions when you're looking for feedback.
The more specific you are with your questions the more likely it is that another member of the community will give you feedback.
## Got feedback for us?
We love receiving feedback! We're always looking to improve our challenges and our platform. So if you have anything you'd like to mention, please email hi[at]frontendmentor[dot]io.
This challenge is completely free. Please share it with anyone who will find it useful for practice.
**Have fun building!** 🚀

View File

@ -0,0 +1,22 @@
[
{
"category": "Reaction",
"score": 80,
"icon": "./assets/images/icon-reaction.svg"
},
{
"category": "Memory",
"score": 92,
"icon": "./assets/images/icon-memory.svg"
},
{
"category": "Verbal",
"score": 61,
"icon": "./assets/images/icon-verbal.svg"
},
{
"category": "Visual",
"score": 72,
"icon": "./assets/images/icon-visual.svg"
}
]

View File

@ -0,0 +1,27 @@
{ lib, pkgs, ... }:
let
pname = "results-summary-component";
version = "0.0.1";
in rec {
package = pkgs.buildGoModule {
inherit pname version;
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
vendorHash = null; # set to "" when get dependencies in go.mod
};
image = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
created = "now";
config = {
Cmd = [
"${package}/bin/results-summary-component-go"
"-p"
"8080"
"-h"
"0.0.0.0"
];
ExposedPorts = { "8080/tcp" = { }; };
};
};
# nixos module
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,3 @@
module sunshine.industries/results-summary-component-go
go 1.20

View File

@ -0,0 +1,34 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--summary-item-color-var: 0deg 100% 67%
}
}
html {
font-size: 18px;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-Medium.ttf') format('truetype');
font-weight: 400; /* Regular */
font-style: normal;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-Bold.ttf') format('truetype');
font-weight: 700; /* Bold */
font-style: normal;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-ExtraBold.ttf') format('truetype');
font-weight: 800; /* ExtraBold */
font-style: normal;
}

View File

@ -0,0 +1,79 @@
package main
import (
"embed"
"flag"
"fmt"
"html/template"
"io"
"log"
"net/http"
)
//go:embed public
var publicContent embed.FS
//go:embed templates
var templates embed.FS
type Category struct {
Name string
ColorHsl string
Score int
IconPath string
}
func iconPath(categoryName string) string {
return fmt.Sprintf("/static/public/images/icon-%s.svg", categoryName)
}
type ResultsSummaryData struct {
Categories []Category
TotalScore int
UpperPercent int
}
// starts webserver that serves html page for exercise
func main() {
// serves public static resources: bundled images, fonts, css
// visible on http://localhost:8080/static/public/some-text.txt
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(publicContent))))
http.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "This is temporary here, hello")
})
resultsData := ResultsSummaryData{
Categories: []Category{
{Name: "Reaction", ColorHsl: "0deg 100% 67%",
Score: 80, IconPath: iconPath("reaction")},
{Name: "Memory", ColorHsl: "39deg 100% 56%",
Score: 92, IconPath: iconPath("memory")},
{Name: "Verbal", ColorHsl: "166deg 100% 37%",
Score: 61, IconPath: iconPath("verbal")},
{Name: "Visual", ColorHsl: "234deg 85% 45%",
Score: 72, IconPath: iconPath("visual")},
},
TotalScore: 76,
UpperPercent: 65,
}
// main page with results summary
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
templateName := "templates/summary-component.gohtml"
tmpl := template.Must(template.ParseFS(templates, "templates/index.gohtml", templateName))
if err := tmpl.Execute(w, resultsData); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
})
var port int
var host string
flag.IntVar(&port, "p", 8080, "Specify port for server to start on")
flag.StringVar(&host, "h", "localhost", "Specify host for server to start on")
flag.Parse()
address := fmt.Sprintf("%s:%d", host, port)
log.Printf("starting server on %s", address)
log.Fatal(http.ListenAndServe(address, nil))
}

View File

@ -0,0 +1,54 @@
Hanken Grotesk Variable Font
============================
This download contains Hanken Grotesk as both variable fonts and static fonts.
Hanken Grotesk is a variable font with this axis:
wght
This means all the styles are contained in these files:
HankenGrotesk-VariableFont_wght.ttf
If your app fully supports variable fonts, you can now pick intermediate styles
that arent available as static fonts. Not all apps support variable fonts, and
in those cases you can use the static font files for Hanken Grotesk:
static/HankenGrotesk-Medium.ttf
static/HankenGrotesk-Bold.ttf
static/HankenGrotesk-ExtraBold.ttf
Get started
-----------
1. Install the font files you want to use
2. Use your app's font picker to view the font family and all the
available styles
Learn more about variable fonts
-------------------------------
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
https://variablefonts.typenetwork.com
https://medium.com/variable-fonts
In desktop apps
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
Online
https://developers.google.com/fonts/docs/getting_started
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
Installing fonts
MacOS: https://support.apple.com/en-us/HT201749
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
Android Apps
https://developers.google.com/fonts/docs/android
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20"><path stroke="#FFB21E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M5.833 11.667a2.5 2.5 0 1 0 .834 4.858"/><path stroke="#FFB21E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M3.553 13.004a3.333 3.333 0 0 1-.728-5.53m.025-.067a2.083 2.083 0 0 1 2.983-2.824m.199.054A2.083 2.083 0 1 1 10 3.75v12.917a1.667 1.667 0 0 1-3.333 0M10 5.833a2.5 2.5 0 0 0 2.5 2.5m1.667 3.334a2.5 2.5 0 1 1-.834 4.858"/><path stroke="#FFB21E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M16.447 13.004a3.334 3.334 0 0 0 .728-5.53m-.025-.067a2.083 2.083 0 0 0-2.983-2.824M10 3.75a2.085 2.085 0 0 1 2.538-2.033 2.084 2.084 0 0 1 1.43 2.92m-.635 12.03a1.667 1.667 0 0 1-3.333 0"/></svg>

After

Width:  |  Height:  |  Size: 831 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20"><path stroke="#F55" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M10.833 8.333V2.5l-6.666 9.167h5V17.5l6.666-9.167h-5Z"/></svg>

After

Width:  |  Height:  |  Size: 247 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20"><path stroke="#00BB8F" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M7.5 10h5M10 18.333A8.333 8.333 0 1 0 1.667 10c0 1.518.406 2.942 1.115 4.167l-.699 3.75 3.75-.699A8.295 8.295 0 0 0 10 18.333Z"/></svg>

After

Width:  |  Height:  |  Size: 323 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20"><path stroke="#1125D6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M10 11.667a1.667 1.667 0 1 0 0-3.334 1.667 1.667 0 0 0 0 3.334Z"/><path stroke="#1125D6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.25" d="M17.5 10c-1.574 2.492-4.402 5-7.5 5s-5.926-2.508-7.5-5C4.416 7.632 6.66 5 10 5s5.584 2.632 7.5 5Z"/></svg>

After

Width:  |  Height:  |  Size: 453 B

View File

@ -0,0 +1,855 @@
/*
! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com
*/
/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/
*,
::before,
::after {
box-sizing: border-box;
/* 1 */
border-width: 0;
/* 2 */
border-style: solid;
/* 2 */
border-color: #e5e7eb;
/* 2 */
}
::before,
::after {
--tw-content: '';
}
/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
*/
html {
line-height: 1.5;
/* 1 */
-webkit-text-size-adjust: 100%;
/* 2 */
-moz-tab-size: 4;
/* 3 */
-o-tab-size: 4;
tab-size: 4;
/* 3 */
font-family: HankenGrotesk, sans-serif;
/* 4 */
font-feature-settings: normal;
/* 5 */
font-variation-settings: normal;
/* 6 */
}
/*
1. Remove the margin in all browsers.
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
*/
body {
margin: 0;
/* 1 */
line-height: inherit;
/* 2 */
}
/*
1. Add the correct height in Firefox.
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
3. Ensure horizontal rules are visible by default.
*/
hr {
height: 0;
/* 1 */
color: inherit;
/* 2 */
border-top-width: 1px;
/* 3 */
}
/*
Add the correct text decoration in Chrome, Edge, and Safari.
*/
abbr:where([title]) {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
/*
Remove the default font size and weight for headings.
*/
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: inherit;
font-weight: inherit;
}
/*
Reset links to optimize for opt-in styling instead of opt-out.
*/
a {
color: inherit;
text-decoration: inherit;
}
/*
Add the correct font weight in Edge and Safari.
*/
b,
strong {
font-weight: bolder;
}
/*
1. Use the user's configured `mono` font family by default.
2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp,
pre {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
/* 1 */
font-size: 1em;
/* 2 */
}
/*
Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/*
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/*
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
3. Remove gaps between table borders by default.
*/
table {
text-indent: 0;
/* 1 */
border-color: inherit;
/* 2 */
border-collapse: collapse;
/* 3 */
}
/*
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
3. Remove default padding in all browsers.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
/* 1 */
font-size: 100%;
/* 1 */
font-weight: inherit;
/* 1 */
line-height: inherit;
/* 1 */
color: inherit;
/* 1 */
margin: 0;
/* 2 */
padding: 0;
/* 3 */
}
/*
Remove the inheritance of text transform in Edge and Firefox.
*/
button,
select {
text-transform: none;
}
/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/
button,
[type='button'],
[type='reset'],
[type='submit'] {
-webkit-appearance: button;
/* 1 */
background-color: transparent;
/* 2 */
background-image: none;
/* 2 */
}
/*
Use the modern Firefox focus style for all focusable elements.
*/
:-moz-focusring {
outline: auto;
}
/*
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
*/
:-moz-ui-invalid {
box-shadow: none;
}
/*
Add the correct vertical alignment in Chrome and Firefox.
*/
progress {
vertical-align: baseline;
}
/*
Correct the cursor style of increment and decrement buttons in Safari.
*/
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
/*
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/
[type='search'] {
-webkit-appearance: textfield;
/* 1 */
outline-offset: -2px;
/* 2 */
}
/*
Remove the inner padding in Chrome and Safari on macOS.
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button;
/* 1 */
font: inherit;
/* 2 */
}
/*
Add the correct display in Chrome and Safari.
*/
summary {
display: list-item;
}
/*
Removes the default spacing and border for appropriate elements.
*/
blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
margin: 0;
}
fieldset {
margin: 0;
padding: 0;
}
legend {
padding: 0;
}
ol,
ul,
menu {
list-style: none;
margin: 0;
padding: 0;
}
/*
Prevent resizing textareas horizontally by default.
*/
textarea {
resize: vertical;
}
/*
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2. Set the default placeholder color to the user's configured gray 400 color.
*/
input::-moz-placeholder, textarea::-moz-placeholder {
opacity: 1;
/* 1 */
color: #9ca3af;
/* 2 */
}
input::placeholder,
textarea::placeholder {
opacity: 1;
/* 1 */
color: #9ca3af;
/* 2 */
}
/*
Set the default cursor for buttons.
*/
button,
[role="button"] {
cursor: pointer;
}
/*
Make sure disabled buttons don't get the pointer cursor.
*/
:disabled {
cursor: default;
}
/*
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
This can trigger a poorly considered lint error in some tools but is included by design.
*/
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
display: block;
/* 1 */
vertical-align: middle;
/* 2 */
}
/*
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
*/
img,
video {
max-width: 100%;
height: auto;
}
/* Make elements with the HTML hidden attribute stay hidden by default */
[hidden] {
display: none;
}
:root {
--summary-item-color-var: 0deg 100% 67%
}
*, ::before, ::after {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-gradient-from-position: ;
--tw-gradient-via-position: ;
--tw-gradient-to-position: ;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / 0.5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
}
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-gradient-from-position: ;
--tw-gradient-via-position: ;
--tw-gradient-to-position: ;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / 0.5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
}
.fixed {
position: fixed;
}
.inset-x-0 {
left: 0px;
right: 0px;
}
.bottom-1 {
bottom: 0.25rem;
}
.block {
display: block;
}
.flex {
display: flex;
}
.grid {
display: grid;
}
.h-12 {
height: 3rem;
}
.h-32 {
height: 8rem;
}
.h-full {
height: 100%;
}
.h-screen {
height: 100vh;
}
.w-32 {
width: 8rem;
}
.w-full {
width: 100%;
}
.w-screen {
width: 100vw;
}
.flex-1 {
flex: 1 1 0%;
}
.flex-row {
flex-direction: row;
}
.flex-col {
flex-direction: column;
}
.place-items-center {
place-items: center;
}
.items-center {
align-items: center;
}
.justify-center {
justify-content: center;
}
.gap-y-3 {
row-gap: 0.75rem;
}
.gap-y-4 {
row-gap: 1rem;
}
.rounded-full {
border-radius: 9999px;
}
.rounded-lg {
border-radius: 0.5rem;
}
.rounded-b-3xl {
border-bottom-right-radius: 1.5rem;
border-bottom-left-radius: 1.5rem;
}
.bg-dark-gray-blue {
--tw-bg-opacity: 1;
background-color: hsl(224 30% 27% / var(--tw-bg-opacity));
}
.bg-summary-item-color\/5 {
background-color: hsl(var(--summary-item-color-var) / 0.05);
}
.bg-gradient-to-t {
background-image: linear-gradient(to top, var(--tw-gradient-stops));
}
.from-light-royal-blue {
--tw-gradient-from: hsl(241, 81%, 54%) var(--tw-gradient-from-position);
--tw-gradient-to: hsl(241 81% 54% / 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
.from-violet-blue\/60 {
--tw-gradient-from: hsla(256, 72%, 46%, 0.6) var(--tw-gradient-from-position);
--tw-gradient-to: hsla(256, 72%, 46%, 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
.from-50\% {
--tw-gradient-from-position: 50%;
}
.to-light-slate-blue {
--tw-gradient-to: hsl(252, 100%, 67%) var(--tw-gradient-to-position);
}
.to-persian-blue\/75 {
--tw-gradient-to: hsla(241, 72%, 46%, 0.75) var(--tw-gradient-to-position);
}
.p-7 {
padding: 1.75rem;
}
.px-10 {
padding-left: 2.5rem;
padding-right: 2.5rem;
}
.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
}
.pb-8 {
padding-bottom: 2rem;
}
.pr-2 {
padding-right: 0.5rem;
}
.pt-4 {
padding-top: 1rem;
}
.text-center {
text-align: center;
}
.text-5xl {
font-size: 3rem;
line-height: 1;
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem;
}
.text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.font-bold {
font-weight: 700;
}
.font-extrabold {
font-weight: 800;
}
.text-dark-gray-blue {
--tw-text-opacity: 1;
color: hsl(224 30% 27% / var(--tw-text-opacity));
}
.text-pale-blue {
--tw-text-opacity: 1;
color: hsl(221 100% 96% / var(--tw-text-opacity));
}
.text-summary-item-color {
--tw-text-opacity: 1;
color: hsl(var(--summary-item-color-var) / var(--tw-text-opacity));
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
html {
font-size: 18px;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-Medium.ttf') format('truetype');
font-weight: 400;
/* Regular */
font-style: normal;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-Bold.ttf') format('truetype');
font-weight: 700;
/* Bold */
font-style: normal;
}
@font-face {
font-family: 'HankenGrotesk';
src: url('/static/public/fonts/static/HankenGrotesk-ExtraBold.ttf') format('truetype');
font-weight: 800;
/* ExtraBold */
font-style: normal;
}
@media (min-width: 768px) {
.md\:h-44 {
height: 11rem;
}
.md\:h-\[500px\] {
height: 500px;
}
.md\:w-1\/2 {
width: 50%;
}
.md\:w-44 {
width: 11rem;
}
.md\:w-\[715px\] {
width: 715px;
}
.md\:flex-row {
flex-direction: row;
}
.md\:justify-around {
justify-content: space-around;
}
.md\:rounded-3xl {
border-radius: 1.5rem;
}
.md\:bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
}
.md\:px-8 {
padding-left: 2rem;
padding-right: 2rem;
}
.md\:pt-2 {
padding-top: 0.5rem;
}
.md\:text-2xl {
font-size: 1.5rem;
line-height: 2rem;
}
.md\:text-6xl {
font-size: 3.75rem;
line-height: 1;
}
.md\:text-base {
font-size: 1rem;
line-height: 1.5rem;
}
.md\:text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.md\:shadow-2xl {
--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.md\:shadow-light-lavender\/50 {
--tw-shadow-color: hsl(241 100% 89% / 0.5);
--tw-shadow: var(--tw-shadow-colored);
}
}

View File

@ -0,0 +1,2 @@
hello!
yoyo

Binary file not shown.

View File

@ -0,0 +1,49 @@
# Front-end Style Guide
## Layout
The designs were created to the following widths:
- Mobile: 375px
- Desktop: 1440px
## Colors
### Primary
- Light red: hsl(0, 100%, 67%)
- Orangey yellow: hsl(39, 100%, 56%)
- Green teal: hsl(166, 100%, 37%)
- Cobalt blue: hsl(234, 85%, 45%)
## Gradients
- Light slate blue (background): hsl(252, 100%, 67%)
- Light royal blue (background): hsl(241, 81%, 54%)
- Violet blue (circle): hsla(256, 72%, 46%, 1)
- Persian blue (circle): hsla(241, 72%, 46%, 0)
### Neutral
- White: hsl(0, 0%, 100%)
- Pale blue: hsl(221, 100%, 96%)
- Light lavender: hsl(241, 100%, 89%)
- Dark gray blue: hsl(224, 30%, 27%)
### Notes
Use transparency to get the colour variations necessary to match the design. Hint: look into using `hsla()`.
## Typography
### Body Copy
- Font size (paragraphs): 18px
### Font
- Family: [Hanken Grotesk](https://fonts.google.com/specimen/Hanken+Grotesk)
- Weights: 500, 700, 800

View File

@ -0,0 +1,24 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./**/*.gohtml"],
theme: {
extend: {
colors: {
'light-slate-blue': 'hsl(252, 100%, 67%)',
'light-royal-blue': 'hsl(241, 81%, 54%)',
'violet-blue': 'hsla(256, 72%, 46%)',
'persian-blue': 'hsla(241, 72%, 46%)',
'pale-blue': 'hsl(221, 100%, 96%)',
'light-lavender': 'hsl(241, 100%, 89%)',
'dark-gray-blue': 'hsl(224, 30%, 27%)',
'summary-item-color': 'hsl(var(--summary-item-color-var) / <alpha-value>)',
},
'fontFamily': {
'sans': ['HankenGrotesk', 'sans-serif'],
'added': ['HankenGrotesk', 'sans-serif'],
},
},
},
plugins: [],
}

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- displays site properly based on user's device -->
<link
rel="stylesheet"
href="static/public/out.css"
type="text/css"
media="screen"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="static/public/images/favicon-32x32.png"
/>
<title>Frontend Mentor | Results summary component</title>
<!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style>
.attribution {
font-size: 11px;
text-align: center;
}
.attribution a {
color: hsl(228, 45%, 44%);
}
</style>
</head>
<body>
<main class="grid place-items-center w-screen h-screen">
{{ template "results-summary-component" . }}
</main>
<footer class="fixed inset-x-0 bottom-1 attribution">
Challenge by
<a href="https://www.frontendmentor.io?ref=challenge" target="_blank"
>Frontend Mentor</a
>. Coded by <a href="#">Your Name Here</a>.
</footer>
</body>
</html>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- displays site properly based on user's device -->
<link
rel="stylesheet"
href="static/public/out.css"
type="text/css"
media="screen"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="static/public/images/favicon-32x32.png"
/>
<title>THIS IS FILE FOR THE COMPONENT</title>
<!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style>
.attribution {
font-size: 11px;
text-align: center;
}
.attribution a {
color: hsl(228, 45%, 44%);
}
</style>
</head>
<body>
<main class="grid place-items-center w-screen h-screen">
{{/* only things inside of block component are used, yay */}}
{{ block "results-summary-component" . }}
<article
class="flex flex-col w-full h-full md:flex-row md:bg-white md:rounded-3xl md:shadow-2xl md:shadow-light-lavender/50 md:w-[715px] md:h-[500px]"
>
<section
id="results-pane"
class="flex flex-col gap-y-4 items-center px-10 pt-4 pb-8 text-white bg-gradient-to-t from-50% rounded-b-3xl md:justify-around md:w-1/2 md:rounded-3xl from-light-royal-blue to-light-slate-blue"
>
<h1 class="font-bold md:pt-2 md:text-xl text-pale-blue">
Your Result
</h1>
<div
class="flex flex-col justify-center items-center w-32 h-32 bg-gradient-to-t rounded-full md:w-44 md:h-44 from-violet-blue/60 to-persian-blue/75"
>
<span class="text-5xl font-extrabold md:text-6xl"
>{{ .TotalScore }}</span
>
<span class="text-pale-blue"> of 100 </span>
</div>
<div class="flex flex-col gap-y-3 items-center">
<h2 class="text-xl font-bold md:text-2xl">Great</h2>
<p class="text-sm text-center md:text-base text-pale-blue">
You scored higher than {{ .UpperPercent }}% of the people who have
taken these tests.
</p>
</div>
</section>
<section
id="summary-pane"
class="flex flex-col gap-y-4 p-7 md:justify-around md:px-8 md:w-1/2"
>
<h2 class="font-bold md:text-xl">Summary</h2>
<dl class="flex flex-col gap-y-4">
{{ range .Categories }}
<div
class="flex flex-row items-center px-5 h-12 text-sm rounded-lg bg-summary-item-color/5"
style="--summary-item-color-var: {{ .ColorHsl }}"
>
<img src="{{ .IconPath }}" alt="" class="pr-2" />
<dt class="flex-1 text-summary-item-color">{{ .Name }}</dt>
<dd class="flex flex-row">
<strong class="pr-2">{{ .Score }}</strong>
<span class="text-dark-gray-blue">/ 100</span>
</dd>
</div>
{{ end }}
</dl>
<a
href="/"
flex
flex-row
class="grid place-items-center w-full h-12 text-white rounded-full bg-dark-gray-blue"
>
Continue
</a>
</section>
</article>
{{ end }}
</main>
<footer class="fixed inset-x-0 bottom-1 attribution">
Challenge by
<a href="https://www.frontendmentor.io?ref=challenge" target="_blank"
>Frontend Mentor</a
>. Coded by <a href="#">Your Name Here</a>.
</footer>
</body>
</html>

View File

@ -36,16 +36,31 @@
inherit pkgs sbt-derivation;
lib = pkgs.lib;
};
results-component-go = import ./17-results-summary-component-go {
inherit pkgs;
lib = pkgs.lib;
};
in {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.scala-cli
pkgs.sbt
pkgs.scalafmt
pkgs.jdk
pkgs.nodePackages.tailwindcss
pkgs.nodePackages.prettier
pkgs.jdk
pkgs.rustywind
pkgs.go
pkgs.wgo
pkgs.semgrep
pkgs.gopls
];
shellHook = ''
export GOPATH=$PWD/.go
export PATH=$GOPATH/bin:$PATH
'';
};
packages.price-grid-app = price-grid.package;
nixosModules.price-grid-app = price-grid.module;
@ -64,6 +79,8 @@
nixosModules.multi-step-form = multi-step-form.module;
packages.countries-page = countries-page.package;
packages.countries-page-image = countries-page.image;
packages.results-component-go = results-component-go.package;
packages.results-component-go-image = results-component-go.image;
});
# see https://serokell.io/blog/practical-nix-flakes
}