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!: version 6 #1028

Open
wants to merge 5 commits into
base: main
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
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {Theme} from '../src';
import {GlobalThemeController} from './theme/utils/global-theme-controller';

import '../styles/styles.scss';
import '@gravity-ui/uikit/styles/fonts.css';

const withContextProvider: Decorator = (Story, context) => {
const theme = context.globals.theme;
Expand Down
2 changes: 2 additions & 0 deletions .storybook/stories/documentation/Blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ _[Common field types](?id=documentation-types&viewMode=docs)_

## [Share](?path=/story/blocks-share--docs&viewMode=docs)

## [<s>SliderOld</s>](?path=/story/blocks-sliderold-deprecated--docs&viewMode=docs) (Deprecated, use Slider instead)

## [Slider](?path=/story/blocks-slider--docs&viewMode=docs)

## [Table](?path=/story/blocks-table--docs&viewMode=docs)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ To use mixins and constructor style variables when creating custom blocks, add i
@import '~@gravity-ui/page-constructor/styles/styles.scss';
```

To use default font, add import in your file:

```css
@import '~@gravity-ui/page-constructor/styles/fonts.scss';
```

### Loadable blocks

It's sometimes necessary that a block renders itself based on data to be loaded. In this case, loadable blocks are used.
Expand Down
1 change: 1 addition & 0 deletions playwright/playwright/index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import '../../styles/styles.scss';
@import '../../styles/fonts.scss';
@import '../../styles/storybook/index.scss';
14 changes: 0 additions & 14 deletions src/blocks/HeaderSlider/HeaderSlider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ $block: '.#{$ns}header-slider-block';
}
}

@media (max-width: map-get($gridBreakpoints, 'md')) {
&.#{$ns}SliderBlock {
margin-left: -$indentXXXS;
padding-left: 0;
width: calc(100% + #{$indentXXXS});
}
}

@media (max-width: map-get($gridBreakpoints, 'sm')) {
&__item-content {
.#{$ns}header-block__content {
Expand All @@ -66,11 +58,5 @@ $block: '.#{$ns}header-slider-block';
padding-left: $indentXS + $indentXXXS;
}
}

.slick-track {
.slick-slide {
max-width: 100%;
}
}
}
}
2 changes: 1 addition & 1 deletion src/blocks/HeaderSlider/HeaderSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {useContext} from 'react';

import {SliderBlock} from '../../blocks';
import {MobileContext} from '../../context/mobileContext';
import {HeaderSliderBlockProps, SliderType} from '../../models';
import {block} from '../../utils';
import Header from '../Header/Header';
import {SliderBlock} from '../index';

import './HeaderSlider.scss';

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/blocks/Media/__stories__/Media.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ const DefaultTemplate: StoryFn<MediaBlockModel> = (args) => (
}),
links: data.common.links as LinkProps[],
},
{
...args,
media: {
light: {
...data.default.content.media.light,
fullscreen: true,
},
dark: {
...data.default.content.media.dark,
fullscreen: true,
},
},
},
],
}}
/>
Expand Down
35 changes: 19 additions & 16 deletions src/blocks/Slider/Arrow/Arrow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,43 @@ $block: '.#{$ns}slider-block-arrow';

$root: &;

width: $sliderArrowSize;
height: $sliderArrowSize;
cursor: pointer;

&_type_left {
#{$root}__icon-wrapper {
transform: rotate(180deg);
}
margin-right: 16px;
}

&__button {
@include reset-button-style();
@include focusable();
}

&__inner {
@include shadow();
@extend %flex;

width: $sliderArrowSize;
height: $sliderArrowSize;

color: var(--g-color-text-secondary);
border-radius: 100%;
background-color: var(--g-color-base-background);
box-shadow: 0 4px 24px var(--pc-color-sfx-shadow), 0 2px 8px var(--pc-color-sfx-shadow);

transition: box-shadow 0.3s $ease-out-cubic, color 1s $ease-out-cubic;

@include focusable();
}
&_type_left {
#{$root}__icon-wrapper {
transform: rotate(180deg);
}
}

&:hover {
#{$root}__button {
&:hover {
color: var(--g-color-text-primary);
box-shadow: 0 2px 12px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
}

&_transparent {
background-color: transparent;
box-shadow: none;

&:hover {
box-shadow: none;
}
}
}

&__icon-wrapper {
Expand Down
36 changes: 24 additions & 12 deletions src/blocks/Slider/Arrow/Arrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,37 @@ export type ArrowType = 'left' | 'right';

export interface ArrowProps {
type: ArrowType;
handleClick?: (direction: ArrowType) => void;
transparent?: boolean;
onClick?: () => void;
size?: number;
extraProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
}

const Arrow = ({type, handleClick, className, size = 16}: ArrowProps & ClassNameProps) => (
<div className={b({type}, className)}>
const Arrow = ({
type,
transparent,
onClick,
className,
size = 16,
extraProps,
}: ArrowProps & ClassNameProps) => (
<div className={b(null, className)}>
<button
className={b('button')}
onClick={() => handleClick && handleClick(type)}
onClick={onClick}
aria-label={i18n(`arrow-${type}`)}
{...extraProps}
>
<span className={b('icon-wrapper')}>
<ToggleArrow
size={size}
type={'horizontal'}
iconType="navigation"
className={b('icon')}
/>
</span>
<div className={b('inner', {type, transparent})}>
<span className={b('icon-wrapper')}>
<ToggleArrow
size={size}
type={'horizontal'}
iconType="navigation"
className={b('icon')}
/>
</span>
</div>
</button>
</div>
);
Expand Down
Loading