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

Created clock #3073

Open
wants to merge 2 commits 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 @@ -26,7 +26,7 @@ Create a working stopwatch with minute and second hands using **only CSS animati
## 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://YarynaPuhach.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
8 changes: 6 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
<title>Stop watch</title>
<link rel="stylesheet" href="./styles/main.scss">
</head>
<body>
<h1>Stop watch</h1>
<body class="page">
<div class="stopwatch">
<div class="stopwatch__minutes-hand"></div>
<div class="stopwatch__seconds-hand"></div>
<div class="stopwatch__center"></div>
</div>
</body>
</html>
6 changes: 5 additions & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// put code here
@import "utils/mixins";
@import "utils/variables";
@import "page";
@import "stopwatch";

8 changes: 8 additions & 0 deletions src/styles/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.page {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
margin: 0;
}
60 changes: 60 additions & 0 deletions src/styles/stopwatch.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.stopwatch {
@include circle($stopwatch-size);

position: relative;
display: flex;
justify-content: center;
align-items: center;
border: 1vmin dotted #000;

&__minutes-hand {
height: $minutes-hand-height;
width: $minutes-hand-weigth;
background-color: $minutes-hand-color;
transform-origin: bottom center;
bottom: 50%;
position: absolute;
z-index: 0;
animation: rotate $min-animation-time steps(60) infinite;
}

&__seconds-hand {
height: $seconds-hand-height;
width: $seconds-hand-weigth;
background-color: $seconds-hand-color;
position: absolute;
z-index: 1;
transform-origin: bottom center;
bottom: 50%;
animation: rotate $sec-animation-time linear infinite;

}
&__center {
@include circle($center-size);

background-color: $center-color;
position: absolute;
z-index: 2;

}

&--speed-up {
.stopwatch__minutes-hand {
animation: rotate $min-animation-time-speed-up steps(60) infinite;
}

.stopwatch__seconds-hand {
animation: rotate $sec-animation-time-speed-up linear infinite;
}
}
}
Comment on lines +41 to +50

Choose a reason for hiding this comment

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

add modifier inside minutes and seconds class Typical BEM Mistakes

Copy link
Author

Choose a reason for hiding this comment

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

Przepraszam, ale czy możesz mi powiedzieć, jak to zrobić poprawnie?
Ponieważ tutaj wartości animacji dla testów z klasą stopwatch--speed-up zostały po prostu zmienione.
Ale nie rozumiem, jak nadać animacji inne wartości, pod warunkiem, że istnieje klasa stopwatch--speed-up bezpośrednio w w stopwatch__minutes-hand i stopwatch__seconds-hand?


@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}

5 changes: 5 additions & 0 deletions src/styles/utils/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@mixin circle($size){
width: $size;
height: $size;
border-radius: 50%;
}
14 changes: 14 additions & 0 deletions src/styles/utils/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$stopwatch-size: 80vmin;
$minutes-hand-height: 20vmin;
$minutes-hand-weigth: 3vmin;
$seconds-hand-height: 38vmin;
$seconds-hand-weigth: 1.5vmin;
$center-size: 5vmin;
$minutes-hand-color: #0700ff;
$seconds-hand-color: #2c8000;
$center-color: #f6a603;
$sec-animation-time: 60s;
$min-animation-time: 3600s;
$sec-animation-time-speed-up: 10s;
$min-animation-time-speed-up: 600s;

Loading