Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add task solution #3496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In this task, you can directly link *.scss files to HTML. This is possible becau
## Checklist

❗️ Replace `<your_account>` with your Github username and copy the links to `Pull Request` description:
- [DEMO LINK](https://<your_account>.github.io/layout_stop-watch/)
- [DEMO LINK](https://kovaltar.github.io/layout_stop-watch/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
10 changes: 9 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
/>
</head>
<body>
<h1>Stop watch</h1>
<!-- <h1>Stop watch</h1> -->

<div class="page">
<div class="stopwatch stopwatch--speed-up">
<div class="stopwatch__minute"></div>
<div class="stopwatch__second"></div>
<div class="stopwatch__center"></div>
</div>
</div>
</body>
</html>
72 changes: 72 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
@import './utils/variables';
@import './utils/mixins';
Comment on lines +1 to +2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the files './utils/variables' and './utils/mixins' exist and contain the necessary variable and mixin definitions used in this SCSS file. Without these definitions, the SCSS compilation will fail.


body {
margin: 0;
}

.page {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.stopwatch {
$duration: 60s;

width: $watch-size;
height: $watch-size;
Comment on lines +18 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables $watch-size, $minute-w, and $minute-h are used here. Ensure these variables are defined in the imported files or within this file to avoid compilation errors.

border: 1vmin dotted #000;
border-radius: 50%;
position: relative;

&__minute {
width: $minute-w;
height: $minute-h;
Comment on lines +25 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables $minute-w and $minute-h are used here. Ensure these variables are defined in the imported files or within this file to avoid compilation errors.

background-color: #0700ff;
position: absolute;
top: #{$watch-size / 2 - $minute-h};
left: #{($watch-size - $minute-w) / 2};

@include watch-animation(
$duration * 60,
(0.5 * $minute-w) $minute-h,
steps(60, end)
);
Comment on lines +32 to +36

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mixin watch-animation is used here. Ensure this mixin is defined in the imported files or within this file to avoid compilation errors.


.stopwatch--speed-up & {
@include watch-animation(
$speed-up-duration * 60,
(0.5 * $minute-w) $minute-h,
steps(60, end)
);
}
}

&__second {
width: $sec-w;
height: $sec-h;
Comment on lines +48 to +49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables $sec-w and $sec-h are used here. Ensure these variables are defined in the imported files or within this file to avoid compilation errors.

background-color: #2c8000;
position: absolute;
top: #{0.5 * $watch-size - $sec-h};
left: #{0.5 * ($watch-size - $sec-w)};

@include watch-animation($default-duration, (0.5 * $sec-w) $sec-h, linear);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mixin watch-animation is used here. Ensure this mixin is defined in the imported files or within this file to avoid compilation errors.


.stopwatch--speed-up & {
@include watch-animation(
$speed-up-duration,
(0.5 * $sec-w) $sec-h,
linear
);
}
}

&__center {
width: $center-size;
height: $center-size;
Comment on lines +67 to +68

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable $center-size is used here. Ensure this variable is defined in the imported files or within this file to avoid compilation errors.

background-color: #f6a603;
border-radius: 50%;
position: absolute;
top: #{0.5 * ($watch-size - $center-size)};
left: #{0.5 * ($watch-size - $center-size)};
}
}
16 changes: 16 additions & 0 deletions src/styles/utils/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@mixin watch-animation($mix-duration, $tr-origin, $t-func) {

& {
transform-origin: $tr-origin;
animation: move $mix-duration $t-func infinite;
}

@keyframes move {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
}
8 changes: 8 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$watch-size: 80vmin;
$minute-w: 3vmin;
$minute-h: 20vmin;
$sec-w: 1.5vmin;
$sec-h: 38vmin;
$center-size: 5vmin;
$default-duration: 60s;
$speed-up-duration: $default-duration / 6;
Loading