-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(query-tracker): added file attachments to queries [#221]
- Loading branch information
1 parent
8518c96
commit 2787d51
Showing
8 changed files
with
564 additions
and
6 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
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; | ||
} | ||
} |
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,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> | ||
</> | ||
); | ||
}; |
49 changes: 49 additions & 0 deletions
49
packages/ui/src/ui/pages/query-tracker/QueryFilesButton/QueryFilesButton.scss
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,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; | ||
} | ||
} | ||
} |
Oops, something went wrong.