Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
favourachara07 committed Mar 8, 2024
1 parent 7b36cbe commit 982c1cc
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 99 deletions.
94 changes: 66 additions & 28 deletions README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,10 @@ Users should be able to:

### Screenshot

![](./screenshot.jpg)
![](./assets/images/Screenshot%20(783).png)

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

Expand All @@ -59,61 +54,104 @@ Then crop/optimize/edit your image however you like, add it to your project, and
- 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
- Vanilla JS

**Note: These are just examples. Delete this note and replace the list above with your own choices**

### What I learned

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.
I really learnt alot during this project. I learned while working on the Javascript section of the project. This project involved calculations that can only be achieved by thinking really logically and reasoning. In the html section, I was able to develop more and better understanding of classes and ids, and also the right use of elements. For the CSS, I was able to understand and develop a method fo styling that suits me, i was also able to understand more concepts that i found challenging by applying it in my styles. For the JS section, I developed a better understanding of the DOM, if and else statements, and I also learnt and developed my principle of critical thinking and reasoning

To see how you can add code snippets, see below:

```html
<h1>Some HTML code I'm proud of</h1>
<div class="agecalc">
<div class="y"><span class="dash1">--</span> years</div>
<div class="m"><span class="dash2">--</span> <span class="per">months</span></div>
<div class="d"><span class="dash3">--</span> days</div>
</div>
```
```css
.proud-of-this-css {
color: papayawhip;
/* the animation of the age numbers */
.animate{
opacity: 0;
animation: myfirst 1s ease-in-out 0.6s normal forwards;
}
@keyframes myfirst {
0% {
opacity: 0%;
}

100% {
opacity: 100%;
}
}
```
```js
const proudOfThisFunc = () => {
console.log('🎉')
}
// the main calculation behind the age calculator
let year_total, month_total, day_total;

if (curMonth > month) {
year_total = curYear - year;
document.querySelector(".dash1").innerText = year_total;
} else {
year_total = curYear - year - 1;
document.querySelector(".dash1").innerText = year_total;
}

if (month <= curMonth) {
month_total = curMonth - month;
monthNames();
document.querySelector(".dash2").innerText = month_total + 1;
} else {
month_total = 12 - (month - curMonth);
monthNames();
document.querySelector(".dash2").innerText = month_total;
}

if (curDay >= day) {
day_total = curDay - day;
monthNames();
document.querySelector(".dash3").innerText = day_total;
} else {
const tempDate = new Date(curYear, curMonth - 1, 0); // Get the last day of the previous month
day_total = tempDate.getDate() - (day - curDay);
monthNames();
document.querySelector(".dash3").innerText = day_total;
}
```

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.
I hope to focus on learning and working with React after i have completed two more projects with html,css and js because working and commanding the dom directly by myself is very tiring. I want that solid foundation before moving on to React. Also, i want to master the act of making my codes shorter and more efficient and cleaner.


**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.
- [W3Schools](https://www.w3schools.com/css) - This helped me for the animation of the age numbers reason. I really liked and I have use this platform before and will continue use it going forward.

**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 - [Favour Achara](https://www.your-site.com)
- Frontend Mentor - [@yourusername](https://www.frontendmentor.io/profile/yourusername)
- Twitter - [@favour2207](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.
I'm actually proud with myself. This is a project that I did independently (95% by myself). Although I got stuck at a point, I did my very best to resolve the dilemma I was in, I solved up to 80% of the problem by myself then I consulted ChatGPT for corrections on what I did.
This is what ChatGPT corrected me on
```js
else {
const tempDate = new Date(curYear, curMonth - 1, 0)
; // Get the last day of the previous month
day_total = tempDate.getDate() - (day - curDay);
monthNames();
document.querySelector(".dash3").innerText = day_total;
```
**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.**
Binary file added assets/images/Screenshot (783).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 13 additions & 10 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ body {
.outline>input{
border-color: red;
}
.outline {
border-color: red;
}
input {
width: 6.25rem;
height: 2.5rem;
Expand Down Expand Up @@ -127,38 +130,38 @@ svg {
.m-txt {
position: absolute;
top: 10px;
left: 133px;
left: 7.6875rem;
}

.y-txt {
position: absolute;
top: 10px;
left: 244px;
left: 14.0625rem;
}

.valid,
.valid1,
.valid2 {
.error-d,
.error-m,
.error-y {
font-size: 0.625rem;
color: red;
}

.valid {
.error-d {
position: absolute;
top: 66px;
left: 18px;
}

.valid1 {
.error-m {
position: absolute;
top: 66px;
left: 132px
left: 7.6875rem
}

.valid2 {
.error-y {
position: absolute;
top: 66px;
left: 245px
left: 14.1875rem;
}

.input_box {
Expand Down
34 changes: 17 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@
<div class="d-txt">Day</div>
<div class="m-txt">Month</div>
<div class="y-txt">Year</div>
<div class="valid"></div>
<div class="valid1"></div>
<div class="valid2"></div>
<div class="error-d"></div>
<div class="error-m"></div>
<div class="error-y"></div>
<div class="input_box">
<input type="text" name="" id="day" placeholder="DD">
<span id="message"></span>
<input type="text" name="" id="month" placeholder="MM">
<input type="text" class="in1" name="" id="day" placeholder="DD">
<input type="text" class="in2" name="" id="month" placeholder="MM">
<!-- <span id="m"></span> -->
<input type="text" name="" id="year" placeholder="YYYY">
<input type="text" name="" class="in3" id="year" placeholder="YYYY">
<!-- <span id="y"></span> -->

</div>
<p class="error"></p>


<svg class="svg" xmlns="http://www.w3.org/2000/svg" width="46" height="44" viewBox="0 0 46 44" onclick="calculateAge()">
<g fill="none" stroke="#FFF" stroke-width="2">
<path d="M1 22.019C8.333 21.686 23 25.616 23 44M23 44V0M45 22.019C37.667 21.686 23 25.616 23 44" />
</g>
</svg>
<p class="error"></p>


<svg class="svg" xmlns="http://www.w3.org/2000/svg" width="46" height="44" viewBox="0 0 46 44"
onclick="calculateAge()">
<g fill="none" stroke="#FFF" stroke-width="2">
<path d="M1 22.019C8.333 21.686 23 25.616 23 44M23 44V0M45 22.019C37.667 21.686 23 25.616 23 44" />
</g>
</svg>




<p id="result"></p>

<div class="agecalc">
<div class="y"><span class="dash1">--</span> years</div>
<div class="m"><span class="dash2">--</span> months</div>
<div class="m"><span class="dash2">--</span> <span class="per">months</span></div>
<div class="d"><span class="dash3">--</span> days</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 982c1cc

Please sign in to comment.