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

docs: add block indents values #1094

Open
wants to merge 2 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
16 changes: 15 additions & 1 deletion .storybook/stories/documentation/Blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,24 @@ Each block has the following common properties:
`resetPaddings: boolean` — Allows resetting top and bottom margins standard for all blocks. **Deprecated**, use `indent` instead

`indent?: {
top?: string
top?: string,
bottom?: string
}` - block indentation at the top and bottom, default size `l`, examples you can see [here](?path=/story/blocks-cardlayout--with-custom-indents)

**indent size values:**

`0` - 0px

`xs` - 16px

`s` - 24px

`m` - 32px

`l` - 48px

`xl` - 64px

_[Common field types](?id=documentation-types&viewMode=docs)_

## [Banner](?path=/story/blocks-banner--docs&viewMode=docs)
Expand Down
72 changes: 72 additions & 0 deletions src/blocks/CardLayout/__stories__/CardLayout.stories.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@import '../../../../styles/variables.scss';
@import '../../../../styles/mixins';

@mixin pseudo($content) {
background: repeating-linear-gradient(
135deg,
#fadae4,
#fadae4 10px,
#f0b4c6 10px,
#f0b4c6 20px
);
content: $content;
display: flex;
align-items: center;
position: absolute;
left: 0;
right: 0;
}

@mixin pseudoTop($size, $textSize) {
&::before {
@include pseudo('top #{$textSize} (#{$size})');
top: -$size;
height: $size;
}
}

@mixin pseudoBottom($size, $textSize) {
&::after {
@include pseudo('bottom #{$textSize} (#{$size})');
bottom: 0;
height: $size;
}
}

.pc-block-base {
&_indentTop {
&_xs {
@include pseudoTop($indentXS, 'XS');
}
&_s {
@include pseudoTop($indentSM, 'S');
}
&_m {
@include pseudoTop($indentM, 'M');
}
&_l {
@include pseudoTop($indentL, 'L');
}
&_xl {
@include pseudoTop($indentXL, 'XL');
}
}

&_indentBottom {
&_xs {
@include pseudoBottom($indentXS, 'XS');
}
&_s {
@include pseudoBottom($indentSM, 'S');
}
&_m {
@include pseudoBottom($indentM, 'M');
}
&_l {
@include pseudoBottom($indentL, 'L');
}
&_xl {
@include pseudoBottom($indentXL, 'XL');
}
}
}
2 changes: 2 additions & 0 deletions src/blocks/CardLayout/__stories__/CardLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import CardLayout from '../CardLayout';

import data from './data.json';

import './CardLayout.stories.scss';

export default {
title: 'Blocks/CardLayout',
component: CardLayout,
Expand Down
Loading