Skip to content

Commit

Permalink
grid system and header
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 18, 2023
1 parent d64510a commit 5349ded
Show file tree
Hide file tree
Showing 19 changed files with 1,497 additions and 16 deletions.
Binary file modified assets/.DS_Store
Binary file not shown.
1,146 changes: 1,146 additions & 0 deletions assets/css/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/main.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions assets/icons/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/icons/buy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/icons/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 12 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@

<body>
<!-- header -->
<header id="header"></header>
<header id="header" class="header"></header>
<script>
load("#header","./template/header.html");
</script>
<!-- Main -->
<h1>home page</h1>

<!-- footer -->
<footer id="footer"></footer>
<script>
load("#footer","./template/footer.html");
</script>
<div class="container">

<!-- Main -->
<h1>home page</h1>

<!-- footer -->
<footer id="footer"></footer>
<script>
load("#footer","./template/footer.html");
</script>
</div>
</body>
</html>

25 changes: 25 additions & 0 deletions scss/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,36 @@
box-sizing: border-box;
}

:root{
// --text-color: #1A162E;
--text-color: #1A162E;
--icon-color: brightness(0) saturate(100%) invert(8%) sepia(7%) saturate(7482%) hue-rotate(217deg) brightness(90%) contrast(95%);
}
html{
font-size: 62.5%;
}

body{
font-size: 1.6rem;
font-family: Gordita, sans-serif;
color: var(--text-color);
}

a{
color: inherit;
text-decoration: none;
}

button{
border: none;
outline: none;
background-color: transparent;
}
button, input, textarea, select{
font-family: inherit;
color:inherit;
}

.icon{
filter: var(--icon-color);
}
134 changes: 134 additions & 0 deletions scss/base/_grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
@use "sass:math";

// Breakpoints, dimension, container, row, column, v.v
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1400px,
);
$container-max-widths: (
sm: 540px,
md: 720px,
lg: 960px,
xl: 1140px,
xxl: 1370px,
);
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
$gutters: (
0: 0,
1: 0.25,
2: 0.5,
3: 1,
4: 1.5,
5: 3,
);

%gutter-padding {
padding-left: calc(var(--grid-gutter-x) * 0.5);
padding-right: calc(var(--grid-gutter-x) * 0.5);
}

.container-fluid {
--grid-gutter-x: #{$grid-gutter-width};
--grid-gutter-y: 0;

width: 100%;
margin-left: auto;
margin-right: auto;
@extend %gutter-padding;
}

.container {
@extend .container-fluid;
}

.row {
display: flex;
flex-wrap: wrap;
margin-top: calc(var(--grid-gutter-y) * -1);
margin-left: calc(var(--grid-gutter-x) * 0.5 * -1);
margin-right: calc(var(--grid-gutter-x) * 0.5 * -1);

> * {
margin-top: var(--grid-gutter-y);
@extend %gutter-padding;
}
}

.col {
flex: 1 0;
}

@mixin make-media-query($dimension, $bypass: false) {
@if $bypass {
@content;
} @else {
@media (min-width: $dimension) {
@content;
}
}
}

@mixin make-row-columns($infix) {
@for $i from 1 through $grid-columns * 0.5 {
.row-cols#{$infix}-#{$i} > * {
flex: 0 0 auto;
width: math.div(100%, $i);
}
}
}

@mixin make-columns($infix) {
@for $i from 1 through $grid-columns {
.col#{$infix}-#{$i} {
flex: 0 0 auto;
width: math.div(100%, $grid-columns) * $i;
}
}
}

@mixin make-offsets($infix) {
@for $i from 0 to $grid-columns {
.offset#{$infix}-#{$i} {
margin-left: if($i > 0, math.div(100%, $grid-columns) * $i, 0);
}
}
}

@mixin make-gutters($infix) {
@each $i, $ratio in $gutters {
.g#{$infix}-#{$i},
.gx#{$infix}-#{$i} {
--grid-gutter-x: #{$grid-gutter-width * $ratio};
}

.g#{$infix}-#{$i},
.gy#{$infix}-#{$i} {
--grid-gutter-y: #{$grid-gutter-width * $ratio};
}
}
}

@each $breakpoint, $dimension in $grid-breakpoints {
$max-width: map-get($container-max-widths, $breakpoint);
$is-xs: $breakpoint == xs;
$infix: if($is-xs, "", "-#{$breakpoint}");

@include make-media-query($dimension, $is-xs) {
.container {
max-width: $max-width;
}

@include make-row-columns($infix);

@include make-columns($infix);

@include make-offsets($infix);

@include make-gutters($infix);
}
}
3 changes: 3 additions & 0 deletions scss/base/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@forward "./reset";
@forward "./base";
@forward "./grid";
1 change: 1 addition & 0 deletions scss/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward "./logo";
14 changes: 14 additions & 0 deletions scss/components/_logo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.logo{
display: flex;
align-items: center;
gap: 14px;
&__title{
font-size: 2.2rem;
font-weight: 700;
line-height: 1.4555em;
};
&__img{
width: 3.2rem;
height: 3.2rem;
}
}
79 changes: 79 additions & 0 deletions scss/layout/_header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
%flexItemsCenter {
display: flex;
align-items: center;
}

.header{
display: flex;
align-items: center;
background: #EEE;

}
.top-bar{
@extend %flexItemsCenter;
padding: 30px 0;
}

.navbar{
margin-left: 144px;
margin-right: auto;
&__list{
@extend %flexItemsCenter;
}

&__link{
font-size: 15px;
font-weight: 500;
line-height: 1.46667em; /* 146.667% */
margin-right: 30px;
display: flex;
gap:6px;
}


}

.top-act{
// margin-left: auto;
@extend %flexItemsCenter;
justify-content: center;
gap:20px;


&__group{
@extend %flexItemsCenter;
border-radius: 8px;
background-color: #fff;
height: 50px;
min-width: 50px;
}

&__group--single &__btn{
padding: 13px;
}
&__btn{
@extend %flexItemsCenter;
gap:10px;
padding: 13px 20px;
cursor: pointer;
}
&__title{
font-size: 1.5rem;
font-weight: 500;
line-height: 1.4667em; /* 146.667% */
}

&__separate{
color:#EDEDF6;
width: 1px;
height: 30px;
}
&__avatar{
display: block;
width: 50px;
height: 50px;
border-radius: 8px;
cursor: pointer;
}

}
1 change: 1 addition & 0 deletions scss/layout/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward "./header";
7 changes: 3 additions & 4 deletions scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use "./base/reset";
@use "./base/base";


@use "./base/" as base;
@use "./layout" as layout;
@use "./components/" as components;
Loading

0 comments on commit 5349ded

Please sign in to comment.