Skip to content

Commit

Permalink
Refactor data.json and add data2023.json (#247)
Browse files Browse the repository at this point in the history
This commit refactors the data.json file by removing some entries and adds a new data2023.json file with additional entries. This ensures that the data for the Hacktoberfest 2023 train is properly separated from the other years' data. The changes also include updating the Home.vue file to include a link for the Hacktoberfest 2023 train. Additionally, the _mixins.scss file has been modified to improve the fluid font size, line height, and bottom mixins.
  • Loading branch information
YasiOnFire authored Oct 1, 2024
1 parent 11e8d5e commit a7f5c6d
Show file tree
Hide file tree
Showing 5 changed files with 471 additions and 326 deletions.
84 changes: 31 additions & 53 deletions src/assets/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,62 +1,40 @@
@use "sass:math";
@use 'sass:math';

$vp-small: 560px;
$vp-large: 1920px;

@mixin fluid-font-size(
$minFontSize: 16px,
$maxFontSize: 20px,
$minViewport: 600px,
$maxViewport: 1200px
) {
$slope: math.div($minFontSize - $maxFontSize, $minViewport - $maxViewport);
$base: $maxFontSize - $slope * $maxViewport;
@mixin fluid-font-size($minFontSize, $maxFontSize, $minViewport, $maxViewport) {
$slope: math.div($maxFontSize - $minFontSize, $maxViewport - $minViewport);
$intercept: $minFontSize - $slope * $minViewport;

font-size: $minFontSize;
font-size: clamp(
#{$minFontSize},
calc(#{$intercept} + #{$slope} * 100vw),
#{$maxFontSize}
);
}

@media (min-width: $minViewport) {
font-size: calc(#{$base} + 100vw * #{$slope});
}
// Mixin for fluid line-height using CSS clamp and math.div
@mixin fluid-line-height($minLineHeight, $maxLineHeight, $minViewport, $maxViewport) {
$slope: math.div($maxLineHeight - $minLineHeight, $maxViewport - $minViewport);
$intercept: $minLineHeight - $slope * $minViewport;

@media (min-width: $maxViewport) {
font-size: $maxFontSize;
}
}
@mixin fluid-bottom(
$minBottom: 16px,
$maxBottom: 20px,
$minViewport: 600px,
$maxViewport: 1200px
) {
$slope: math.div(($minBottom - $maxBottom), ($minViewport - $maxViewport));
$base: $maxBottom - $slope * $maxViewport;

bottom: $minBottom;

@media (min-width: $minViewport) {
bottom: calc(#{$base} + 100vw * #{$slope});
}

@media (min-width: $maxViewport) {
bottom: $maxBottom;
}
line-height: clamp(
#{$minLineHeight},
calc(#{$intercept} + #{$slope} * 100vw),
#{$maxLineHeight}
);
}
@mixin fluid-line-height(
$minLineHeight: 16px,
$maxLineHeight: 20px,
$minViewport: 600px,
$maxViewport: 1200px
) {
$slope: math.div(($minLineHeight - $maxLineHeight), ($minViewport - $maxViewport));
$base: $maxLineHeight - $slope * $maxViewport;

line-height: $minLineHeight;

@media (min-width: $minViewport) {
line-height: calc(#{$base} + 100vw * #{$slope});
}

@media (min-width: $maxViewport) {
line-height: $maxLineHeight;
}

// Mixin for fluid bottom using CSS clamp and math.div
@mixin fluid-bottom($minBottom, $maxBottom, $minViewport, $maxViewport) {
$slope: math.div($maxBottom - $minBottom, $maxViewport - $minViewport);
$intercept: $minBottom - $slope * $minViewport;

bottom: clamp(
#{$minBottom},
calc(#{$intercept} + #{$slope} * 100vw),
#{$maxBottom}
);
}

32 changes: 1 addition & 31 deletions src/assets/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,5 @@
"name": "YasiOnFire",
"text": "Yasio says Hi!",
"cart": 0
},
{
"name": "DustyDogCodex",
"text": "I like ChooChoo Train!",
"cart": 5
},
{
"name": "elo",
"text": "test",
"cart": 5
},
{
"name": "kryzysiek",
"text": "Hello Maciuś !",
"cart": 4
},
{
"name": "rajabilal555",
"text": "The One piece is real!",
"cart": 6
},
{
"name": "installemployee",
"text": "Happy Hacking",
"cart": 4
},
{
"name": "aitikirala",
"text": "Hey guys!",
"cart": 0
}
]
]
37 changes: 37 additions & 0 deletions src/assets/data2023.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"name": "YasiOnFire",
"text": "Yasio says Hi!",
"cart": 0
},
{
"name": "DustyDogCodex",
"text": "I like ChooChoo Train!",
"cart": 5
},
{
"name": "elo",
"text": "test",
"cart": 5
},
{
"name": "kryzysiek",
"text": "Hello Maciuś !",
"cart": 4
},
{
"name": "rajabilal555",
"text": "The One piece is real!",
"cart": 6
},
{
"name": "installemployee",
"text": "Happy Hacking",
"cart": 4
},
{
"name": "aitikirala",
"text": "Hey guys!",
"cart": 0
}
]
19 changes: 15 additions & 4 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,44 @@
>.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />
----------------------------------------------------------------------------<br />
| <router-link to="/about" class="brn">About</router-link> |
<a
href="#"
class="brn"
@click.prevent="toggleYear(2024)"
title="Switch to Hacktoberfest 2024 Train"
>2024</a
>
|
<a
href="#"
class="brn"
@click.prevent="toggleYear(2023)"
title="Switch to Hacktoberfest 2023 Train"
>2023</a
>23</a
>
|
<a
href="#"
class="brn"
@click.prevent="toggleYear(2022)"
title="Switch to Hacktoberfest 2022 Train"
>2022</a
>22</a
>
|
<a
href="#"
class="brn"
@click.prevent="toggleYear(2021)"
title="Switch to Hacktoberfest 2021 Train"
>2021</a
>21</a
>
|
<a
href="#"
class="brn"
@click.prevent="toggleYear(2020)"
title="Switch to Hacktoberfest 2020 Train"
>2020</a
>20</a
>
|
<input
Expand Down Expand Up @@ -71,6 +79,7 @@ import data from "@/assets/data.json";
import data2020 from "@/assets/data2020.json";
import data2021 from "@/assets/data2021.json";
import data2022 from "@/assets/data2022.json";
import data2023 from "@/assets/data2023.json";
import { encodeHTML, formatFixer } from "@/assets/utils.js";
import { computed, ref } from "vue";
Expand Down Expand Up @@ -112,6 +121,8 @@ export default {
? data2020
: year.value === 2022
? data2022
: year.value === 2023
? data2023
: data;
};
Expand Down
Loading

0 comments on commit a7f5c6d

Please sign in to comment.