-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SubBlocks): add possibility to position controls within cards at…
… footer (#823) * feat(SubBlocks): add possibility to position controls within cards at footer * fix: comments * feat: add storybook for changes * fix: apply the required behavioral changes * fix: resolve comments * fix: lint
- Loading branch information
1 parent
8fe9e19
commit 7e3dc0b
Showing
32 changed files
with
725 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@import '../../../styles/variables.scss'; | ||
|
||
$block: '.#{$ns}buttons'; | ||
|
||
#{$block} { | ||
display: flex; | ||
flex-wrap: wrap; | ||
column-gap: $indentXXS; | ||
|
||
&_size { | ||
&_s { | ||
row-gap: $indentXXXS; | ||
} | ||
|
||
&_l { | ||
row-gap: $indentXXS; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
|
||
import {ButtonProps, ContentSize} from '../../models'; | ||
import {block} from '../../utils'; | ||
import Button from '../Button/Button'; | ||
|
||
import './Buttons.scss'; | ||
|
||
const b = block('buttons'); | ||
|
||
type ButtonsProps = { | ||
className?: string; | ||
buttons?: ButtonProps[]; | ||
size?: ContentSize; | ||
titleId?: string; | ||
qa?: string; | ||
buttonQa?: string; | ||
}; | ||
|
||
function getButtonSize(size: ContentSize) { | ||
switch (size) { | ||
case 's': | ||
return 'm'; | ||
case 'l': | ||
default: | ||
return 'xl'; | ||
} | ||
} | ||
|
||
const Buttons: React.FC<ButtonsProps> = ({className, titleId, buttons, size = 's', qa, buttonQa}) => | ||
buttons ? ( | ||
<div className={b({size}, className)} data-qa={qa}> | ||
{buttons.map((item) => ( | ||
<Button | ||
className={b('button')} | ||
{...item} | ||
key={item.url} | ||
size={getButtonSize(size)} | ||
qa={buttonQa} | ||
extraProps={{ | ||
'aria-describedby': item.urlTitle ? undefined : titleId, | ||
...item.extraProps, | ||
}} | ||
/> | ||
))} | ||
</div> | ||
) : null; | ||
|
||
export default Buttons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@import '../../../styles/variables.scss'; | ||
|
||
$block: '.#{$ns}links'; | ||
|
||
#{$block} { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: baseline; | ||
|
||
&__link { | ||
margin-top: 0px; | ||
} | ||
|
||
&_size { | ||
&_s { | ||
gap: $indentXXXS; | ||
} | ||
|
||
&_l { | ||
gap: $indentXXS; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
|
||
import {ContentSize, LinkProps} from '../../models'; | ||
import {block} from '../../utils'; | ||
import Link from '../Link/Link'; | ||
|
||
import './Links.scss'; | ||
|
||
const b = block('links'); | ||
|
||
function getLinkSize(size: ContentSize) { | ||
switch (size) { | ||
case 's': | ||
return 'm'; | ||
case 'l': | ||
default: | ||
return 'l'; | ||
} | ||
} | ||
|
||
type LinksProps = { | ||
className?: string; | ||
titleId?: string; | ||
links?: LinkProps[]; | ||
size?: ContentSize; | ||
qa?: string; | ||
linkQa?: string; | ||
}; | ||
|
||
const Links: React.FC<LinksProps> = ({className, titleId, links, size = 's', qa, linkQa}) => | ||
links ? ( | ||
<div className={b({size}, className)} data-qa={qa}> | ||
{links?.map((link) => ( | ||
<Link | ||
className={b('link')} | ||
{...link} | ||
textSize={getLinkSize(size)} | ||
key={link.url} | ||
qa={linkQa} | ||
extraProps={{ | ||
'aria-describedby': link.urlTitle ? undefined : titleId, | ||
...link.extraProps, | ||
}} | ||
/> | ||
))} | ||
</div> | ||
) : null; | ||
|
||
export default Links; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.