Skip to content

Commit

Permalink
feat(query-tracker): added file attachments to queries [#221]
Browse files Browse the repository at this point in the history
  • Loading branch information
yandex-moonbreeze committed Dec 12, 2023
1 parent 8518c96 commit 2fbe96b
Show file tree
Hide file tree
Showing 8 changed files with 568 additions and 6 deletions.
9 changes: 9 additions & 0 deletions packages/ui/src/ui/components/ButtonPopup/ButtonPopup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.button-popup {
min-width: 620px;
padding: 16px 20px;

&__top-row {
display: flex;
justify-content: space-between;
}
}
45 changes: 45 additions & 0 deletions packages/ui/src/ui/components/ButtonPopup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, {useRef, useState} from 'react';
import {Button, Icon, IconData, Popup, Text} from '@gravity-ui/uikit';
import closeIcon from '@gravity-ui/icons/svgs/xmark.svg';

import cn from 'bem-cn-lite';
import './ButtonPopup.scss';

const b = cn('button-popup');

type ButtonPopupProps = {
icon: IconData;
header: React.ReactNode;
children: React.ReactNode;
counter?: number;
};

export const ButtonWithPopup = ({icon, header, children, counter}: ButtonPopupProps) => {
const btnRef = useRef(null);
const [open, setOpen] = useState(false);
const toggle = () => setOpen(!open);
return (
<>
<Button ref={btnRef} onClick={toggle} view="outlined" size="l">
<Icon data={icon} size={16} />
{counter ? <Text>{counter}</Text> : undefined}
</Button>
<Popup
open={open}
anchorRef={btnRef}
placement={'bottom-start'}
onOutsideClick={toggle}
>
<div className={b()}>
<div className={b('top-row')}>
{header}
<Button onClick={toggle} view="flat">
<Icon data={closeIcon} />
</Button>
</div>
{children}
</div>
</Popup>
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.query-files-popup {
width: 640px;
&__header {
display: flex;
align-items: center;
gap: 5px;
}
&__footer {
display: flex;
gap: 10px;
}

&__file-list {
display: flex;
flex-direction: column;
gap: 10px;
padding-bottom: 10px;
}

&__file-item {
padding: 10px 0;
width: 100%;
height: 48px;
display: grid;
grid-template-columns: 1fr min-content;
align-items: center;
gap: 10px;
&-icon {
min-width: fit-content;
}
&-body,&-controls {
min-width: 0;
height: 100%;
display: flex;
align-items: center;
gap: 10px;
}
&-body_edit {
align-items: flex-start;
}
&-controls_edit {
align-items: flex-start;
padding-top: 5px;
}
&-body_deleted>:last-child {
flex-shrink: 0;
}
}
}
Loading

0 comments on commit 2fbe96b

Please sign in to comment.