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

feat: add translations adaptive mobile #133

Open
wants to merge 1 commit into
base: feat/frontend-adaptive
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function ServicesTranslation() {
<div className={styles.info}>
<Image
className={styles.translationIcon}
width={62}
height={53}
width={window.matchMedia('(min-width: 768px)').matches ? 62 : 50}
Copy link
Owner

Choose a reason for hiding this comment

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

На фреймворке React/Next.js лучше не обращаться к глобальному объекту window из-за системы рендерингов. Следует написать кастомный хук. Давай пока уберем эти строчки и поправим впоследствии, когда вернемся к адаптиву?

https://medium.com/swlh/using-window-matchmedia-for-media-queries-in-reactjs-97ddc66fca2e - здесь интересная статья

height={window.matchMedia('(min-width: 768px)').matches ? 53 : 42}
src={translationIcon}
alt="Перевести"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

@media screen and (max-width: calc($media-laptop - 1px)) {
width: calc(100% - $margin-blocks-sides-formula-tablet);
margin-left: $margin-blocks-sides-formula-tablet;
padding-left: $margin-blocks-sides-formula-tablet;
}

@media screen and (max-width: calc($media-tablet - 1px)) {
width: calc(100% - 18px * 2);
padding: 100px 18px;
}
}

Expand All @@ -41,6 +46,10 @@
);

text-transform: uppercase;

@media screen and (max-width: calc($media-tablet - 1px)) {
font-size: $font-size-heading-s;
}
}

.description {
Expand All @@ -51,6 +60,10 @@
@include render-font();

color: $color-main-1;

@media screen and (max-width: calc($media-tablet - 1px)) {
padding: 0;
}
}

.button {
Expand All @@ -73,6 +86,12 @@
padding-left: 30px;
padding-right: 30px;
}

@media screen and (max-width: calc($media-tablet - 1px)) {
box-sizing: border-box;
width: 100%;
text-align: center;
}
}

.translationImage {
Expand All @@ -81,11 +100,16 @@
background-repeat: no-repeat;
background-size: cover;
background-position: center;
z-index: 10;

@media screen and (max-width: calc($media-laptop - 1px)) {
width: 100vw;
width: 100%;
height: 350px;
}

@media screen and (max-width: calc($media-tablet - 1px)) {
height: 300px;
}
}

.decorativeTile {
Expand All @@ -96,4 +120,11 @@
background: url(../../../public/assets/icons/tile-4.svg) center no-repeat;
width: 119px;
height: 79px;

@media screen and (max-width: calc($media-tablet - 1px)) {
width: 96px;
height: 64px;
bottom: -16px;
background-size: contain;
}
}
1 change: 1 addition & 0 deletions frontend/src/styles/abstracts/variables/fonts.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$font-size-heading-accent: 4rem;
$font-size-heading: 2.6rem;
$font-size-heading-s: 2.2rem;
$font-size-subheading: 2rem;
$font-size-main-text-l: 1.6rem;
$font-size-main-text: 1.4rem;
Expand Down