Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @baseapp-frontend/components

## 0.0.17

### Patch Changes

Updated dependencies
- @baseapp-frontend/design-system@0.0.17

Comment on lines +3 to +9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Changelog entries don't reflect the PR objectives

The changelog entry for version 0.0.17 only mentions updating the design-system dependency, but doesn't describe the actual changes implemented in this PR:

  • File size limit feature for the Dropzone component
  • Fix for the "Change Image" button functionality

Consider adding these important changes to make the changelog more informative for users.

 ## 0.0.17

 ### Patch Changes

+ - Added file size limit feature to Dropzone component
+ - Fixed "Change Image" button functionality
 Updated dependencies
   - @baseapp-frontend/design-system@0.0.17
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 0.0.17
### Patch Changes
Updated dependencies
- @baseapp-frontend/design-system@0.0.17
## 0.0.17
### Patch Changes
- Added file size limit feature to Dropzone component
- Fixed "Change Image" button functionality
Updated dependencies
- @baseapp-frontend/design-system@0.0.17
🧰 Tools
🪛 Markdownlint (0.35.0)

8-8: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)

## 0.0.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/components",
"description": "BaseApp components modules such as comments, notifications, messages, and more.",
"version": "0.0.16",
"version": "0.0.17",
"main": "./index.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
Expand Down
6 changes: 6 additions & 0 deletions packages/design-system/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @baseapp-frontend/design-system

## 0.0.18

### Patch Changes

- Impose file size limits on Dropzones

## 0.0.17

### Patch Changes
Expand Down
37 changes: 23 additions & 14 deletions packages/design-system/components/Dropzone/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, useState } from 'react'
import React, { FC, useState } from 'react'

import { getImageString } from '@baseapp-frontend/utils'
import { getImageString, useNotification } from '@baseapp-frontend/utils'

import { Box, Button, Card, Typography } from '@mui/material'
import { useDropzone } from 'react-dropzone'
Expand All @@ -20,15 +20,21 @@ const Dropzone: FC<DropzoneProps> = ({
onSelect,
onRemove,
actionText = 'Upload Image',
subTitle = 'Max. File Size: 15MB',
maxFileSize = 15,
subTitle = `Max. File Size: ${maxFileSize}MB`,
DropzoneOptions,
}) => {
const [files, setFiles] = useState<string | undefined>(storedImg)
const { sendToast } = useNotification()

const { open, getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone({
accept,
onDrop: async (acceptedFiles: any) => {
if (acceptedFiles.length === 0) return
if (acceptedFiles[0].size > maxFileSize * 1024 * 1024) {
sendToast(`This file is too large (max ${maxFileSize} MB).`, { type: 'error' })
return
}
const imgString = await getImageString(acceptedFiles[0])
if (!imgString) return
setFiles(imgString)
Expand All @@ -45,20 +51,23 @@ const Dropzone: FC<DropzoneProps> = ({
const renderContent = () => {
if (files)
return (
<Card>
<Box p={2} display="flex" flexDirection="column" alignItems="center">
<img
key={files}
src={files}
alt="preview"
style={{ maxHeight: '200px', maxWidth: '100%' }}
/>
</Box>
</Card>
<>
<input {...getInputProps()} />
<Card>
<Box p={2} display="flex" flexDirection="column" alignItems="center">
<img
key={files}
src={files}
alt="preview"
style={{ maxHeight: '200px', maxWidth: '100%' }}
/>
</Box>
</Card>
</>
)

return (
<div className="w-full container max-w-none">
<div className="container w-full max-w-none">
<InputContainer {...getRootProps({ isFocused, isDragAccept, isDragReject })}>
<input {...getInputProps()} />
{isDragReject ? (
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/components/Dropzone/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export interface DropzoneProps {
onRemove: () => void
actionText?: string
subTitle?: string
maxFileSize?: number
DropzoneOptions?: Partial<DropzoneOptions>
}
2 changes: 1 addition & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/design-system",
"description": "Design System components and configurations.",
"version": "0.0.17",
"version": "0.0.18",
"main": "./index.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
Expand Down
Loading