Skip to content

Commit

Permalink
fixed pictures and started with hex copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
staxx6 committed Jul 3, 2018
1 parent b9ab9a1 commit 3d34d05
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 22 deletions.
37 changes: 33 additions & 4 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
--color-black: #2C2C2D;
--color-black-hex: 44, 44, 45;
--color-white:#F9F9F9;
--color-white-rgb: 249, 249, 249;
--color-magenta: #F50D5F;
--color-magenta-rgb: 245, 13, 95;
--anim-shake: 1.4s;
--anim-shake-delay: 0.4s 1s; }

Expand Down Expand Up @@ -172,6 +175,25 @@ body {
transform: translate(-23rem, 3rem); }
.main-text__color::after {
transform: rotate(180deg) translate(-1.2rem, -3rem); }
.main-text__color-btn, .main-text__color-btn-txt {
background: none;
border: none;
outline: none; }

.link--outside {
display: inline-block; }
.link--outside, .link--outside:link, .link--outside:visited {
text-decoration: none;
color: var(--color-magenta);
padding: 1px 3px;
margin: -1px -3px;
transition: all .2s; }
.link--outside:active, .link--outside:focus, .link--outside:hover {
color: var(--color-white);
background: var(--color-magenta); }
.link--outside:active, .link--outside:focus {
outline: none;
transform: translateY(1px); }

.main {
display: grid;
Expand Down Expand Up @@ -210,10 +232,15 @@ body {
grid-column: 4 / span 1; }
.footer__list-item--3 {
grid-column: 6 / span 1; }
.footer__btn {
.footer__btn, .footer__btn:link, .footer__btn:visited {
text-decoration: none;
color: var(--color-footer);
transition: color var(--anim-shake-delay); }
padding: 1px 3px;
margin: -1px -3px;
transition: color var(--anim-shake-delay), background 0.2s; }
.footer__btn:active, .footer__btn:focus, .footer__btn:hover {
background: rgba(var(--color-black-hex), 0.7);
outline: none; }

.popup {
height: 100vh;
Expand All @@ -236,7 +263,7 @@ body {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 48%;
width: 38%;
background-color: var(--color-white);
box-shadow: 0 2rem 3rem rgba(var(--color-black-hex), 0.2);
border-radius: 3px;
Expand Down Expand Up @@ -266,9 +293,11 @@ body {
transition: all .2s;
transform-origin: 50% 50%; }
.popup__btn-close:hover, .popup__btn-close:focus {
color: orangered; }
color: var(--color-magenta); }
.popup__btn-close:active {
transform: scale(0.4); }
.popup__header {
margin-bottom: -2rem; }
.popup:target {
opacity: 1;
visibility: visible; }
Binary file added img/github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 7 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<button class="main-text__btn-shake" onclick="shake()">Shake</button>
<div class="main-text__for">for</div>
<div class="main-text__color">color</div>
<!-- --anim to start anim-->
</main>

<footer class="footer">
Expand All @@ -29,9 +28,6 @@
<li class="footer__list-item--1">
<a href="#about" class="footer__btn">about</a>
</li>
<!-- <li class="footer__list-item--2">
<a href="#" class="footer__btn">@staxx6</a>
</li> -->
<li class="footer__list-item--2">
<a href="#source" class="footer__btn">source</a>
</li>
Expand All @@ -48,6 +44,9 @@
<div class="popup popup--about" id="about">
<div class="popup-content">
<a href="#" class="popup__btn-close">&times;</a>
<h2 class="popup__header">
About me
</h2>
<p class="popup-paragraph popup-paragraph--about">
This page was created for my personal challange to create one mockup a day. Maybe I get some inspiration from this random
colors to use in my daily mockups.
Expand All @@ -57,18 +56,18 @@
<p class="popup-paragraph popup-paragraph--me">
My name is
<em>Simon Oczadly</em> (@staxx6) and you can find my website here:
<a href="https://staxx6.github.io/" class="link link-outsite">staxx6.github.io</a>
<a href="https://staxx6.github.io/" class="link link--outside">staxx6.github.io</a>
</p>
</div>
</div>

<div class="popup popup--source" id="source">
<div class="popup-content">
<a href="#" class="popup__btn-close">&times;</a>
<img src="../img/git-logo.svg" alt="Github logo" class="popup-img">
<img src="../img/github-logo.png" alt="Github logo" class="popup-img">
<p class="popup-paragraph">
You can find the source of this site on Github
<a href="https://github.com/staxx6/shake" class="link link-outsite">github.com/staxx6/shake</a>
You can find the source of this site on GitHub:
<a href="https://github.com/staxx6/shake" class="link link--outside">github.com/staxx6/shake</a>
</p>
</div>
</div>
Expand Down
14 changes: 12 additions & 2 deletions js/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ let brightness = (colorHex) => {
);
}

// Creates a textinput field inside a button
let colorBtn = (newColor) => `<button id=\"btn-color\" class=\"main-text__color-btn\" onclick=\"copyHex()\"><input type=\"text\" value=\"${newColor}\" id=\"btn-txt-color\" class=\"main-text__color-btn-txt\" readOnly=\"readOnly\"></button>`;

let copyHex = () => {
let btn = document.getElementById('btn-txt-color');
btn.select();
document.execCommand("copy");
}

let shake = () => {
let newColor = getNewColor(); // TODO here new color func //demo color: #F5309C
let newColor = getNewColor();
setDocStyleProperty('--color-main', newColor);

let varColorText = brightness(newColor) < 130 ? '--color-white' : '--color-black';
Expand All @@ -40,7 +49,8 @@ let shake = () => {
getFirstClass('main-text__color').style.animation = `shake-color ${animationTime}s ease-in-out`;

setTimeout(() => {
getFirstClass('main-text__color').innerHTML = newColor;
//getFirstClass('main-text__color').innerHTML = newColor; // without text copy
getFirstClass('main-text__color').innerHTML = colorBtn(newColor);
setDocStyleProperty('--color-color', newColor);
}, animationTime / 2 * 1000 + 50);

Expand Down
7 changes: 5 additions & 2 deletions sass/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// COLORS
--color-main: #F9F9F9; //TODO: name it white
--color-main-hex: 249, 249, 249;
--color-main-hex: 249, 249, 249; //rgb not hex
--color-shake: #2574BB;
--color-for: #31C432;
--color-color: #F9F9F9;
Expand All @@ -19,8 +19,11 @@
--color-footer: #2C2C2D;

--color-black: #2C2C2D;
--color-black-hex: 44, 44, 45;
--color-black-hex: 44, 44, 45; // rgb not hex
--color-white:#F9F9F9;
--color-white-rgb: 249, 249, 249;
--color-magenta: #F50D5F;
--color-magenta-rgb: 245, 13, 95;

// ANIMATIONS TIME
--anim-shake: 1.4s;
Expand Down
28 changes: 28 additions & 0 deletions sass/components/_link.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.link {
&--outside {
display: inline-block;

&,
&:link,
&:visited {
text-decoration: none;
color: var(--color-magenta);
padding: 1px 3px;
margin: -1px -3px;
transition: all .2s;
}

&:active,
&:focus,
&:hover {
color: var(--color-white);
background: var(--color-magenta);
}

&:active,
&:focus {
outline: none;
transform: translateY(1px);
}
}
}
9 changes: 8 additions & 1 deletion sass/components/_main-text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

&:active,
&:focus {
outline:0;
outline: 0;
}
}

Expand Down Expand Up @@ -101,5 +101,12 @@
&::after {
transform: rotate(180deg) translate(-1.2rem, -3rem);
}

&-btn,
&-btn-txt {
background: none;
border: none;
outline: none;
}
}
}
27 changes: 22 additions & 5 deletions sass/layout/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,22 @@
}

&__btn {
text-decoration: none;
color: var(--color-footer);
transition: color var(--anim-shake-delay);
&,
&:link,
&:visited {
text-decoration: none;
color: var(--color-footer);
padding: 1px 3px;
margin: -1px -3px;
transition: color var(--anim-shake-delay), background .2s;
}

&:active,
&:focus,
&:hover {
background: rgba(var(--color-black-hex), .7);
outline: none;
}
}
}

Expand Down Expand Up @@ -72,7 +85,7 @@

&-content {
@include absCenter;
width: 48%;
width: 38%;
background-color: var(--color-white);
box-shadow: 0 2rem 3rem rgba(var(--color-black-hex), .2);
border-radius: 3px;
Expand Down Expand Up @@ -117,14 +130,18 @@
&:focus {
// transform: scale(1.4);
// text-shadow:
color: orangered;
color: var(--color-magenta);
}

&:active {
transform: scale(0.4);
}
}

&__header {
margin-bottom: -2rem;
}

// Open states
&:target {
opacity: 1;
Expand Down
1 change: 1 addition & 0 deletions sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import "components/button";
@import "components/form";
@import "components/main-text";
@import "components/link";

@import "layout/main";
@import "layout/header";
Expand Down

0 comments on commit 3d34d05

Please sign in to comment.