generated from gravity-ui/package-example
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(OneOfTogglerCard): added new display toggler card (#99)
- Loading branch information
1 parent
ff23507
commit caa76bc
Showing
11 changed files
with
162 additions
and
16 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@import '../../styles/variables.scss'; | ||
|
||
.#{$ns}toggler-card { | ||
width: 254px; | ||
padding: 10px; | ||
height: 88px; | ||
|
||
&__header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: baseline; | ||
} | ||
|
||
&__text { | ||
margin-top: 12px; | ||
display: block; | ||
margin-right: 15px; | ||
height: 36px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
} |
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,51 @@ | ||
import React from 'react'; | ||
|
||
import {HelpPopover} from '@gravity-ui/components'; | ||
import {Card, Text} from '@gravity-ui/uikit'; | ||
|
||
import {block} from '../../utils'; | ||
|
||
import './TogglerCard.scss'; | ||
|
||
const b = block('toggler-card'); | ||
|
||
interface TogglerCardProps { | ||
description?: string; | ||
title: string; | ||
text: string; | ||
onClick: () => void; | ||
disabled?: boolean; | ||
selected: boolean; | ||
} | ||
|
||
export const TogglerCard: React.FC<TogglerCardProps> = ({ | ||
description, | ||
title, | ||
text, | ||
onClick, | ||
disabled, | ||
selected, | ||
}) => { | ||
return ( | ||
<Card | ||
onClick={onClick} | ||
type="selection" | ||
disabled={disabled ? !selected : disabled} | ||
selected={selected} | ||
size="m" | ||
className={b()} | ||
> | ||
<div className={b('header')}> | ||
<Text variant="subheader-2" ellipsis> | ||
{title} | ||
</Text> | ||
{description ? ( | ||
<HelpPopover htmlContent={description} placement={['bottom', 'top']} /> | ||
) : null} | ||
</div> | ||
<Text variant="body-1" color="secondary" className={b('text')}> | ||
{text} | ||
</Text> | ||
</Card> | ||
); | ||
}; |
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 @@ | ||
export * from './TogglerCard'; |
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
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