Skip to content

Commit

Permalink
feat(ActionsPanel): add component and showcases (#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoncool authored Oct 2, 2024
1 parent 20f19dd commit 5ce703f
Show file tree
Hide file tree
Showing 21 changed files with 1,234 additions and 1 deletion.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* @amje @ValeraS @korvin89
/src/components/ActionsPanel @jhoncool
/src/components/ActionTooltip @amje
/src/components/Alert @IsaevAlexandr
/src/components/ArrowToggle @Marginy605
Expand Down
24 changes: 24 additions & 0 deletions src/components/ActionsPanel/ActionsPanel.scss
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;
}
}
58 changes: 58 additions & 0 deletions src/components/ActionsPanel/ActionsPanel.tsx
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>
);
};
Loading

0 comments on commit 5ce703f

Please sign in to comment.