Skip to content

Instantly share code, notes, and snippets.

@A-Ostrovnyy
Last active June 5, 2020 21:49
Show Gist options
  • Save A-Ostrovnyy/5638ff534594a30e886854d70f50e484 to your computer and use it in GitHub Desktop.
Save A-Ostrovnyy/5638ff534594a30e886854d70f50e484 to your computer and use it in GitHub Desktop.
Some students mistakes and good parts from Kottans frontend cource 2019
// Giant unsorted class
/*
* Some sprcific rules better put in global scope
* Use comments to describe sections of class. Example: box-model, typgraphy ...
*/
&__button-input {
appearance: none;
box-sizing: content-box;
font-family: "ddg-serp-icons";
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
text-decoration: none;
font-smoothing: antialiased;
osx-font-smoothing: grayscale;
tap-highlight-color: transparent;
width: 1em;
display: block;
cursor: pointer;
background: transparent;
text-align: center;
border: none;
position: absolute;
top: 0;
bottom: 0;
right: 2px;
left: auto;
margin: auto;
z-index: 2;
outline: none;
border-radius: 0 2px 2px 0;
min-width: 26px;
color: #999;
font-size: 1.25em;
padding: 0 0.64em;
height: auto;
min-height: 1.8em;
margin-top: -1px;
margin-bottom: -1px;
margin-right: -3px;
line-height: 1.5;
background-color: transparent;
background-position: 50% 50%;
background-repeat: no-repeat;
font-smoothing: subpixel-antialiased;
}
//Mixin for media rules
=r($width)
@media only screen and (max-width: $width+ "px")
@content
.nav
font-family: $bebas
font-size: 16px
+r(1000)
position: absolute
top: -500px
.nav__list
margin: 0
padding: 0
+r(1000)
flex-direction: column
justify-content: flex-start
.nav__list::after
content: ''
display: none
+r(1000)
display: block
.nav__item
margin-left: 30px
color: $nav
+r(1000)
margin-bottom: 30px
// Hard reading class
.nav{
display: flex;
margin: 20px 20px 0 0;
& li{
margin-left: 20px;
}
&__bell{
color: $font-color;
display: block;
margin-top: 2px;
@include transition;
&:hover{
opacity: 0.8;
}
}
&__auth{
background-color: #00897b;
@include transition;
&::before {
content: url(../assets/img/photo.png);
}
&:hover {
opacity: .8;
}
}
&__link{
color: $font-color;
@include transition;
&:hover{
color: $font-color;
text-decoration: underline;
}
}
&__menu{
display: none;
right: 1%;
&_rect{
content: "";
width: 0;
}
&_lists{
display: flex;
justify-content: space-between;
}
&_listsMore{
display: none;
}
& li{
margin: 1px;
border-radius: 2px;
& a{
color: rgba(0,0,0,0.87);
@include transition;
&:focus{
outline: 3px solid $focused;
transition: none;
}
&:active{
outline: 2px solid lightgreen;
}
}
&:hover{
& a{
border: 1px solid rgba(0,0,0,.2);
}
& .nav__menu_title {
z-index: 3;
background: rgba(255,255,255,.9);
}
}
}
&_icon{
background-image: url(../assets/img/sprite.png);
background-size: 64px 2410px;
&-user{
background-position-y: -70px;
}
&-search{
background-position-y: -1311px;
}
&-map{
background-position-y: -207px;
}
&-youtube{
background-position-y: -550px;
}
&-news{
background-position-y: -1034px;
}
&-gmail{
background-position-y: -1103px;
}
&-contacts{
background-position-y: -2140px;
}
&-disk{
background-position-y: -2002px;
}
&-calendar{
background-position-y: -829px;
}
&-google{
background-position-y: -412px;
}
&-translate{
background-position-y: -1657px;
}
&-photo{
background-position-y: -1519px;
}
&-doc{
background-position-y: 959px;
}
&-blogger{
background-position-y: 339px;
}
&-hangout{
background-position-y: 821px;
}
&-keep{
background-position-y: 1028px;
}
&-jamboard{
background-position-y: 1509px;
}
&-class{
background-position-y: 1789px;
}
&-earth{
background-position-y: 544px;
}
&-collection{
background-position-y: 684px;
}
}
&_title{
text-align: center;
display: block;
text-overflow: ellipsis;
}
&_input{
display: none;
& ~ label{
text-align: center;
background-color: $bg-color;
}
&:checked{
& ~ label{
height: 2px;
span{
display: none;
}
}
& ~ .nav__menu_listsMore{
display: flex;
justify-content: flex-start;
}
& ~ .nav__menu_linkMore{
display: block;
text-align: center;
}
}
}
&_linkMore{
display: none;
font-size: 0.9em;
&:hover{
text-decoration: underline;
opacity: 0.8;
}
}
&_listMore {
animation-name: google;
animation-duration: 0.5s;
animation-timing-function: ease;
animation-delay: 0s;
animation-iteration-count: 1;
animation-direction: normal;
animation-fill-mode: none;
animation-play-state: running;
}
}
&__input{
display: none;
&_icons{
top: -1px;
padding: 0;
&:hover .nav__input_icon{
color: #000;
}
}
&_icon{
display: block;
font-size: 0.55em;
@include transition;
&:after,
&:before{
position: absolute;
content: "■";
right: calc(100% + 1px);
}
&:after{
left: calc(100% + 1px);
}
}
& ~ label {
color: #999999;
}
&_close{
animation-fill-mode: none;
animation-play-state: running;
}
&:checked{
& ~ label{
color: #000;
& > .nav__input_close{
display: block;
}
&::before,
&::after {
content: '';
position: absolute;
}
&::after {
border-bottom: 10px solid white;
top: 32px;
}
}
& ~ .nav__menu{
display: block;
}
}
}
}
// Too specific selector
*, body {
margin: 0;
padding: 0;
line-height: 1;
box-sizing: border-box;
font-family: arial, sans-serif; }
.header {
padding: 20px; }
li {
list-style: none; }
a {
text-decoration: none;
color: rgba(0, 0, 0, 0.87);
line-height: 24px;
font-size: 14px; }
.navigation {
display: flex;
align-items: center; }
.navigation-list {
display: -webkit-box;
display: -webkit-flex;
position: relative; }
.navigation-list .list-item {
margin: 0 10px; }
.navigation-list .list-item .post:hover,
.navigation-list .list-item .images:hover {
border-bottom: 1px solid #000; }
.navigation-list .list-item:focus {
outline: none; }
.navigation-list .list-item .apps-input {
display: none; }
.navigation-list .list-item .apps-label .apps-icon {
width: 20px;
height: 20px;
background-size: contain;
display: block; }
.navigation-list .list-item .apps-label .apps-icon:hover {
opacity: 1; }
.navigation-list .list-item .apps-label .apps-close {
height: 100vh;
z-index: -1; }
.navigation-list .list-item .apps-popup {
display: none; }
.navigation-list .list-item .apps-popup:before {
content: "";
width: 12px;
transform: rotate(-45deg); }
.navigation-list .list-item .apps-popup .wrapper {
-webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block {
display: flex;
padding: 15px 20px; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .popup-item {
width: 33%;
text-align: center;
padding: 6px;
border: 1px solid #fff; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .popup-item:hover {
border: 1px solid #ddd; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .popup-item .app-image {
width: 70%;
height: 50px; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .other-products {
width: 100%;
color: rgba(0, 0, 0, 0.87);
text-align: center;
margin-top: 30px; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .other-products:hover {
color: #808080; }
.navigation-list .list-item .apps-popup .wrapper .apps-popup-block .account-image {
border-radius: 50%; }
.navigation-list .list-item .apps-popup .wrapper .additional-items {
display: none; }
.navigation-list .list-item .apps-popup .more-apps {
display: none; }
.navigation-list .list-item .apps-popup .more-apps:checked ~ .additional-items {
display: flex; }
.navigation-list .list-item .apps-popup .more-apps:checked ~ .more-button {
display: block;
margin: 0 auto; }
.navigation-list .list-item .apps-popup .more-button {
font-size: 14px;
opacity: 1;
border: 1px solid #f5f5f5; }
.navigation-list .list-item .apps-popup .more-button:hover {
border: 1px solid #ccc; }
.navigation-list .notify {
padding: 5px;
background: #000;
opacity: 0.5;
-webkit-border-radius: 20px;
border-radius: 20px; }
.navigation-list .notify:hover {
opacity: 1; }
.navigation-list .notify-link {
display: block;
background-size: 70%; }
.navigation-list .user {
-webkit-border-radius: 20px;
border-radius: 20px;
position: relative;
padding: 5px; }
.navigation-list .user-link {
background-image: url(https://lh3.googleusercontent.com/-wR45nNlb0jY/AAAAAAAAAAI/AAAAAAAAAAA/ACevoQOrtxfoKv7go3rZDlVl-xoTZ7AifA/s64-c-mo/photo.jpg);
display: block;
border-radius: 20px; }
.apps-input:checked ~ .apps-popup {
display: block;
}
.apps-input:focus ~ .apps-label .apps-icon {
outline: 2px solid #4d90fe; }
.apps-input:checked + .apps-label > .apps-close {
display: block; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment