Skip to content

Commit 38c28cf

Browse files
committed
added todos, cleaned up comments. updated readme
1 parent 5014a2b commit 38c28cf

File tree

5 files changed

+152
-81
lines changed

5 files changed

+152
-81
lines changed

README.md

+52-65
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,81 @@
1-
# Frontend Mentor - Calculator app
1+
# Frontend Mentor - Calculator app solution
22

3-
![Design preview for the Calculator app coding challenge](./design/desktop-preview.jpg)
3+
This is a solution to the [Calculator app challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/calculator-app-9lteq5N29). Frontend Mentor challenges help you improve your coding skills by building realistic projects.
44

5-
## Welcome! 👋
5+
## Table of contents
66

7-
Thanks for checking out this front-end coding challenge.
7+
- [Overview](#overview)
8+
- [The challenge](#the-challenge)
9+
- [Screenshot](#screenshot)
10+
- [Links](#links)
11+
- [My process](#my-process)
12+
- [Built with](#built-with)
13+
- [What I learned](#what-i-learned)
14+
- [Continued development](#continued-development)
15+
- [Useful resources](#useful-resources)
16+
- [Author](#author)
817

9-
[Frontend Mentor](https://www.frontendmentor.io) challenges help you improve your coding skills by building realistic projects.
18+
## Overview
1019

11-
**To do this challenge, you need a good understanding of HTML, CSS and JavaScript.**
20+
### The challenge
1221

13-
## The challenge
14-
15-
Your challenge is to build out this calculator app and get it looking as close to the design as possible.
16-
17-
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.
18-
19-
Your users should be able to:
22+
Users should be able to:
2023

2124
- See the size of the elements adjust based on their device's screen size
2225
- Perform mathematical operations like addition, subtraction, multiplication, and division
2326
- Adjust the color theme based on their preference
2427
- **Bonus**: Have their initial theme preference checked using `prefers-color-scheme` and have any additional changes saved in the browser
2528

26-
Want some support on the challenge? [Join our Slack community](https://www.frontendmentor.io/slack) and ask questions in the **#help** channel.
27-
28-
## Where to find everything
29-
30-
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.
31-
32-
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`.
33-
34-
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).
35-
36-
You will find all the required assets in the `/images` folder. The assets are already optimized.
37-
38-
There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts.
39-
40-
## Building your project
41-
42-
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:
43-
44-
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/).
45-
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.
46-
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.
47-
4. Before adding any styles, structure your content with HTML. Writing your HTML first can help focus your attention on creating well-structured content.
48-
5. Write out the base styles for your project, including general content styles, such as `font-family` and `font-size`.
49-
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.
50-
51-
## Deploying your project
52-
53-
As mentioned above, there are many ways to host your project for free. Our recommend hosts are:
54-
55-
- [GitHub Pages](https://pages.github.com/)
56-
- [Vercel](https://vercel.com/)
57-
- [Netlify](https://www.netlify.com/)
29+
### Screenshot
5830

59-
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).
31+
![My beautiful calculator](./images/screenshot.jpg)
6032

61-
## Create a custom `README.md`
33+
### Links
6234

63-
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.
35+
- Solution URL: [GitHub page](https://github.com/gpend/calc-app)
36+
- Live Site URL: [live site](https://gpend.github.io/calc-app/)
6437

65-
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.
38+
## My process
6639

67-
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.
40+
### Built with
6841

69-
## Submitting your solution
42+
- Semantic HTML5 markup
43+
- CSS custom properties
44+
- Flexbox
45+
- Mobile-first workflow
46+
- [jquery](https://jquery.com/) - JS library
7047

71-
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.
48+
### What I learned
7249

73-
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.
50+
- css variables
51+
- css transitions and animation
52+
- adding multiple listeners
7453

75-
## Sharing your solution
54+
### Code I'm proud of
7655

77-
There are multiple places you can share your solution:
56+
```js
57+
pushables.forEach(btn => {
58+
btn.addEventListener('click', (event) => {
59+
calculate( event.target.innerText );
60+
})
61+
})
62+
```
7863

79-
1. Share your solution page in the **#finished-projects** channel of the [Slack community](https://www.frontendmentor.io/slack).
80-
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.
81-
3. Share your solution on other social channels like LinkedIn.
82-
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/).
64+
### Continued development
8365

84-
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.
66+
This was a fun challenge and a good introduction to some interesting concepts that I plan to work on and refine in the future.
8567

86-
The more specific you are with your questions the more likely it is that another member of the community will give you feedback.
68+
- css animations
69+
- draggable elements
70+
- multiple themes
8771

88-
## Got feedback for us?
72+
### Useful resources
8973

90-
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.
74+
- [Building a Magical 3D Button](https://www.joshwcomeau.com/animation/3d-button/) - This awesome tutorial helped me build the buttons.
75+
- [16 segment font](https://www.dafont.com/16-segments.font) - This is a must have font for a calculator of this caliber.
9176

92-
This challenge is completely free. Please share it with anyone who will find it useful for practice.
77+
## Author
9378

94-
**Have fun building!** 🚀
79+
- Greg Pendleton - [gpendleton.me](https://gpendleton.me)
80+
- Frontend Mentor - [@gpend](https://www.frontendmentor.io/profile/gpend)
81+
- Github - [gpend](https://github.com/gpend)

calc.css

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/*TODO screen size adjustments*/
2+
13
#theme1{
24
--equals-color:hsl(6, 63%, 50%);
35
--equals-shadow: hsl(6, 70%, 34%);
@@ -75,8 +77,6 @@ body{
7577
width: 100%;
7678
align-content: center;
7779
justify-content: space-between;
78-
/* border:1px white solid; */
79-
/* justify-content: space-between; */
8080
}
8181

8282
.header .header-text{
@@ -91,8 +91,6 @@ body{
9191
flex-direction: row;
9292
padding-right: 10px;
9393
order:2;
94-
/* border:1px white solid; */
95-
9694
}
9795

9896
.toggle-col{
@@ -106,7 +104,6 @@ body{
106104
width: 80%;
107105
flex-direction: row;
108106
justify-content: space-between;
109-
/* border:1px white solid; */
110107
margin-left: 5px;
111108
}
112109

@@ -122,7 +119,6 @@ body{
122119
background-color: var(--calc-body-color);
123120
border-radius: 20px;
124121
display: flex;
125-
/* position: absolute; */
126122
}
127123

128124
.toggle-trough .toggle-dot{
@@ -133,7 +129,6 @@ body{
133129
border-radius: 100%;
134130
background-color: var(--equals-color);
135131
align-self: center;
136-
margin-left: 0 /* 30%, auto */
137132
}
138133

139134
#display{
@@ -147,14 +142,11 @@ body{
147142
border-radius: inherit;
148143
font-family: '16segments-basic', 'Segment7Standard';
149144
font-size: 50pt;
150-
/* font-style: italic; */
151-
/* text-justify: ; */
152145
}
153146

154147
#display p{
155148
position: relative;
156149
bottom: 55px;
157-
/* right: 10px; */
158150
margin-left: auto;
159151
margin-right: 5px;
160152
width: 95%;
@@ -184,7 +176,6 @@ body{
184176
height: 100%;
185177
border-radius: 12px;
186178
background-color: var(--key-shadow);
187-
/* background-color: hsl(0deg 0% 0% / 0.25); */
188179
will-change: transform;
189180
transform: translateY(2px);
190181
transition:
@@ -224,9 +215,10 @@ body{
224215
600ms
225216
cubic-bezier(.3, .7, .4, 1);
226217
}
227-
/* .pushable:hover {
218+
.pushable:hover {
228219
filter: brightness(110%);
229220
}
221+
/*
230222
.pushable:hover .front {
231223
transform: translateY(-6px);
232224
transition:
@@ -265,9 +257,6 @@ table td{
265257
width: 25%;
266258
height: 2em;
267259
font-size: 2em;
268-
/* background-color: hsl(30, 25%, 89%);
269-
text-align: center;
270-
border-radius: 15px; */
271260
}
272261

273262
.highlight-key .front{

calculator.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ let theme = 1
1212
// }
1313

1414
// TODO split the numbers between operations
15-
15+
// TODO remember theme via `prefers-color-scheme` in browser
16+
// TODO make the theme dot clickable
1617

1718
function calculate (num) {
1819
if (num == 'RESET'){

guide.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Frontend Mentor - Calculator app
2+
3+
![Design preview for the Calculator app coding challenge](./design/desktop-preview.jpg)
4+
5+
## Welcome! 👋
6+
7+
Thanks for checking out this front-end coding challenge.
8+
9+
[Frontend Mentor](https://www.frontendmentor.io) challenges help you improve your coding skills by building realistic projects.
10+
11+
**To do this challenge, you need a good understanding of HTML, CSS and JavaScript.**
12+
13+
## The challenge
14+
15+
Your challenge is to build out this calculator app and get it looking as close to the design as possible.
16+
17+
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.
18+
19+
Your users should be able to:
20+
21+
- See the size of the elements adjust based on their device's screen size
22+
- Perform mathematical operations like addition, subtraction, multiplication, and division
23+
- Adjust the color theme based on their preference
24+
- **Bonus**: Have their initial theme preference checked using `prefers-color-scheme` and have any additional changes saved in the browser
25+
26+
Want some support on the challenge? [Join our Slack community](https://www.frontendmentor.io/slack) and ask questions in the **#help** channel.
27+
28+
## Where to find everything
29+
30+
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.
31+
32+
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`.
33+
34+
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).
35+
36+
You will find all the required assets in the `/images` folder. The assets are already optimized.
37+
38+
There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts.
39+
40+
## Building your project
41+
42+
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:
43+
44+
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/).
45+
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.
46+
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.
47+
4. Before adding any styles, structure your content with HTML. Writing your HTML first can help focus your attention on creating well-structured content.
48+
5. Write out the base styles for your project, including general content styles, such as `font-family` and `font-size`.
49+
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.
50+
51+
## Deploying your project
52+
53+
As mentioned above, there are many ways to host your project for free. Our recommend hosts are:
54+
55+
- [GitHub Pages](https://pages.github.com/)
56+
- [Vercel](https://vercel.com/)
57+
- [Netlify](https://www.netlify.com/)
58+
59+
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).
60+
61+
## Create a custom `README.md`
62+
63+
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.
64+
65+
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.
66+
67+
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.
68+
69+
## Submitting your solution
70+
71+
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.
72+
73+
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.
74+
75+
## Sharing your solution
76+
77+
There are multiple places you can share your solution:
78+
79+
1. Share your solution page in the **#finished-projects** channel of the [Slack community](https://www.frontendmentor.io/slack).
80+
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.
81+
3. Share your solution on other social channels like LinkedIn.
82+
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/).
83+
84+
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.
85+
86+
The more specific you are with your questions the more likely it is that another member of the community will give you feedback.
87+
88+
## Got feedback for us?
89+
90+
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.
91+
92+
This challenge is completely free. Please share it with anyone who will find it useful for practice.
93+
94+
**Have fun building!** 🚀

images/Screenshot.jpg

71.4 KB
Loading

0 commit comments

Comments
 (0)