generated from gravity-ui/package-example
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DefinitionList): support grouped items (#191)
Co-authored-by: Elena Makarova <[email protected]>
- Loading branch information
Showing
10 changed files
with
315 additions
and
138 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
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,29 @@ | ||
import React from 'react'; | ||
|
||
import {ClipboardButton} from '@gravity-ui/uikit'; | ||
|
||
import type {DefinitionListProps, DefinitionListSingleItem} from '../types'; | ||
import {b} from '../utils'; | ||
|
||
interface DefinitionProps | ||
extends Pick<DefinitionListSingleItem, 'copyText' | 'content'>, | ||
Pick<DefinitionListProps, 'copyPosition'> {} | ||
|
||
export function Definition({copyText, content, copyPosition}: DefinitionProps) { | ||
const iconInside = copyPosition === 'inside'; | ||
const definitionContent = content ?? '—'; | ||
|
||
return copyText ? ( | ||
<div className={b('copy-container', {'icon-inside': iconInside})}> | ||
<span>{definitionContent}</span> | ||
<ClipboardButton | ||
size="s" | ||
text={copyText} | ||
className={b('copy-button')} | ||
view={iconInside ? 'raised' : 'flat-secondary'} | ||
/> | ||
</div> | ||
) : ( | ||
definitionContent | ||
); | ||
} |
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 React from 'react'; | ||
|
||
import {Text} from '@gravity-ui/uikit'; | ||
|
||
import {b} from '../utils'; | ||
|
||
interface GroupLabelProps { | ||
label: React.ReactNode; | ||
} | ||
|
||
export function GroupLabel({label}: GroupLabelProps) { | ||
return ( | ||
<div className={b('title')}> | ||
<Text variant="subheader-1" color="complementary"> | ||
{label} | ||
</Text> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.