Skip to content

Commit

Permalink
feat(dropzone): add block prop (#813)
Browse files Browse the repository at this point in the history
Co-authored-by: Кононенко Артем Игоревич <AIKononenko@alfabank.ru>
  • Loading branch information
Artess999 and Кононенко Артем Игоревич committed Aug 27, 2021
1 parent 68468dd commit 39bf4c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/dropzone/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export type DropzoneProps = {
*/
overlayVisible?: boolean;

/**
* Растягивать ли компонент на всю ширину
*/
block?: boolean;

/**
* Обработчик события 'drop'
*/
Expand Down Expand Up @@ -62,6 +67,7 @@ export const Dropzone: FC<DropzoneProps> = ({
onDragLeave,
onDragOver,
onDrop,
block = false,
dataTestId,
}) => {
const [dragOver, setDragOver] = useState(false);
Expand Down Expand Up @@ -138,6 +144,7 @@ export const Dropzone: FC<DropzoneProps> = ({
className={cn(styles.component, className, {
[styles.dragOver]: dragOver || overlayVisible,
[styles.error]: error,
[styles.block]: block,
})}
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
Expand Down
4 changes: 3 additions & 1 deletion packages/dropzone/src/docs/Component.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ import Description from './description.mdx';
return (
<Dropzone
error={boolean('error', false)}
block={boolean('block', false)}
overlayVisible={boolean('overlayVisible', false)}
onDrop={handleDrop}
>
<div
style={{
width: 400,
minWidth: 400,
width: '100%',
height: 200,
display: 'flex',
alignItems: 'center',
Expand Down
4 changes: 4 additions & 0 deletions packages/dropzone/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
}
}

.block {
width: 100%;
}

.overlay {
position: absolute;
top: 0;
Expand Down

0 comments on commit 39bf4c3

Please sign in to comment.