-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ActionsPanel): add component and showcases (#1873)
- Loading branch information
Showing
21 changed files
with
1,234 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,24 @@ | ||
@use '../variables'; | ||
|
||
$block: '.#{variables.$ns}actions-panel'; | ||
|
||
#{$block} { | ||
box-sizing: border-box; | ||
background-color: var(--g-color-base-brand); | ||
min-width: 200px; | ||
height: 52px; | ||
padding: 4px 20px; | ||
border-radius: 10px; | ||
display: flex; | ||
align-items: center; | ||
|
||
&__note-wrapper { | ||
min-width: 100px; | ||
margin-inline-end: 40px; | ||
} | ||
|
||
&__button-close { | ||
flex-shrink: 0; | ||
margin-inline-start: auto; | ||
} | ||
} |
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,58 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import {Xmark} from '@gravity-ui/icons'; | ||
|
||
import {Button} from '../Button'; | ||
import {Icon} from '../Icon'; | ||
import {Text} from '../Text'; | ||
import {block} from '../utils/cn'; | ||
|
||
import {CollapseActions} from './components/CollapseActions'; | ||
import i18n from './i18n'; | ||
import type {ActionsPanelProps} from './types'; | ||
|
||
import './ActionsPanel.scss'; | ||
|
||
const b = block('actions-panel'); | ||
|
||
export const ActionsPanel = ({ | ||
className, | ||
actions, | ||
onClose, | ||
renderNote, | ||
noteClassName, | ||
qa, | ||
maxRowActions, | ||
}: ActionsPanelProps) => { | ||
return ( | ||
<div className={b(null, className)} data-qa={qa}> | ||
{typeof renderNote === 'function' && ( | ||
<Text | ||
className={b('note-wrapper', noteClassName)} | ||
as="div" | ||
color="light-primary" | ||
variant="subheader-2" | ||
ellipsis={true} | ||
> | ||
{renderNote()} | ||
</Text> | ||
)} | ||
<CollapseActions actions={actions} maxRowActions={maxRowActions} /> | ||
{typeof onClose === 'function' && ( | ||
<Button | ||
view="flat-contrast" | ||
size="m" | ||
onClick={onClose} | ||
className={b('button-close')} | ||
extraProps={{ | ||
'aria-label': i18n('label_close'), | ||
}} | ||
> | ||
<Icon key="icon" data={Xmark} /> | ||
</Button> | ||
)} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.