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: update github promotion block #209

Merged
merged 8 commits into from
Jun 3, 2024
Merged
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
3 changes: 1 addition & 2 deletions public/locales/en/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
"roadmap_items_item11": "<b>Page constructor:</b> footer block",
"templates_title": "Start creating with Gravity&nbsp;UI",
"companies_title": "Trusted by",
"github_stars-text": "Do&nbsp;you 💖 Gravity UI? Give&nbsp;us",
"github_stars-button": "Star"
"github_stars-text": "Do&nbsp;you 💖 Gravity UI? Give&nbsp;us&nbsp;a&nbsp;⭐&nbsp;on&nbsp;Github"
}
3 changes: 1 addition & 2 deletions public/locales/ru/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
"roadmap_items_item11": "<b>Page constructor:</b> блок футера",
"templates_title": "Начните создавать проекты с Gravity&nbsp;UI",
"companies_title": "Нам доверяют",
"github_stars-text": "Вам нравится 💖 Gravity UI? Поставьте нам",
"github_stars-button": "Звезду"
"github_stars-text": "Вам нравится 💖 Gravity UI? Поставьте&nbsp;нам&nbsp;⭐&nbsp;на&nbsp;Github"
}
31 changes: 24 additions & 7 deletions src/blocks/GithubStarsBlock/GithubStarsBlock.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,50 @@ $block: '.#{variables.$ns}github-stars-promotion';
align-items: center;
justify-content: center;
gap: var(--g-spacing-2);
padding: var(--g-spacing-1) var(--g-spacing-1) var(--g-spacing-1) var(--g-spacing-4);
border-radius: var(--g-border-radius-m);
padding: var(--g-spacing-2) var(--g-spacing-4);
padding-right: var(--g-spacing-2);
text-decoration: none;
background: #cda2e7;

&:hover {
background: #e2bbfa;
}

@media (max-width: map-get(pcVariables.$gridBreakpoints, 'sm') - 1) {
width: 100%;
}

@media (min-width: map-get(pcVariables.$gridBreakpoints, 'sm')) {
border-radius: var(--g-border-radius-m);
transform: translateX(calc(100% + 2 * var(--g-spacing-2)));
animation: leftBlockAnimation 250ms ease-out forwards;
animation-delay: 500ms;
}

&__text {
display: flex;
align-items: center;
gap: var(--g-spacing-1);

& > .g-icon {
flex: 1 0 auto;
}
}

&__wrapper {
display: flex;
justify-content: flex-end;
align-items: center;

padding-top: var(--g-spacing-2);

@media (min-width: map-get(pcVariables.$gridBreakpoints, 'sm')) {
position: absolute;
overflow: hidden;
left: 0;
right: 0;
z-index: 9;

padding-left: var(--g-spacing-2);
padding-right: var(--g-spacing-2);
padding: var(--g-spacing-2);
padding-bottom: 0;

&[data-hide='true'] {
display: none;
Expand All @@ -54,7 +71,7 @@ $block: '.#{variables.$ns}github-stars-promotion';

@media (max-width: map-get(pcVariables.$gridBreakpoints, 'sm') - 1) {
justify-content: center;

margin: 0 -24px;
&[data-device='desktop'] {
display: none;
}
Expand Down
12 changes: 4 additions & 8 deletions src/blocks/GithubStarsBlock/GithubStarsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Star} from '@gravity-ui/icons';
import {ChevronRight} from '@gravity-ui/icons';
import {Animatable, HTML} from '@gravity-ui/page-constructor';
import {Button, Icon, Text} from '@gravity-ui/uikit';
import {Icon, Text} from '@gravity-ui/uikit';
import {useTranslation} from 'next-i18next';
import {useRouter} from 'next/router';
import React, {useEffect, useState} from 'react';
Expand Down Expand Up @@ -42,14 +42,10 @@ export const GithubStarsBlock: React.FC<GithubStarsBlockProps> = ({device}) => {
return (
<div className={b('wrapper')} data-hide={hide} data-device={device}>
<a className={b()} href={GITHUB_UI_KIT_URL} target="_blank" onClick={hideBlock}>
<Text color="dark-primary" variant="body-2">
<Text color="dark-primary" variant="body-2" className={b('text')}>
<HTML>{t('home:github_stars-text')}</HTML>
<Icon data={ChevronRight} size="16" />
</Text>

<Button view="normal-contrast" size="m" tabIndex={-1}>
<Icon data={Star} size={16} />
<Text variant="body-1">{t('home:github_stars-button')}</Text>
</Button>
</a>
</div>
);
Expand Down
Loading