Skip to content

Commit

Permalink
updated uploader previw styles and css version fix (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swathi-eGov authored Jun 25, 2024
1 parent ccd6889 commit 6318a3e
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 29 deletions.
4 changes: 4 additions & 0 deletions react/css/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.0.2-beta.9] - 2024-06-25
### Added
- Updated Uploader preview styles

## [0.0.2-beta.6] - 2024-06-24
### Added
- Added ViewMore button for timeline molecule
Expand Down
2 changes: 1 addition & 1 deletion react/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-components-css",
"version": "0.0.2-beta.8",
"version": "0.0.2-beta.9",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
59 changes: 46 additions & 13 deletions react/css/src/digitv2/components/uploaderV2.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,36 @@
.digit-uploader-content {
@apply flex w-full;
gap: theme(digitv2.spacers.spacer3);

@media (min-width: 30.063rem) and (max-width: 47.938rem) {
max-width: 27.5rem;
min-width: 21rem;
}

@media (max-width: 30rem) {
max-width: 20.563rem;
min-width: 18rem;
}

@media (min-width: 48rem) {
max-width: 37.5rem;
min-width: 20.75rem;
}

}

label {
outline: none !important;
}

.digit-uploader-content-uploadpopup {
@apply flex flex-col w-full items-center justify-center max-w-full border-dashed;
@apply flex flex-col w-full items-center justify-center max-w-full;
gap: theme(digitv2.spacers.spacer4);
border: 0.063rem solid theme(digitv2.lightTheme.generic-divider);
background: theme(digitv2.lightTheme.paper-secondary);
padding: theme(digitv2.spacers.spacer4);
height: 9rem;
border-style: dashed;

@media (min-width: 30.063rem) and (max-width: 47.938rem) {
min-width: 18.75rem;
Expand Down Expand Up @@ -125,7 +142,7 @@
}

&.error {
@apply border-dashed;
border-style: dashed !important;
border: 0.094rem solid theme(digitv2.lightTheme.alert-error);
}
}
Expand Down Expand Up @@ -216,7 +233,6 @@
}
}


.digit-docupload-icon{
border: 0.063rem solid theme(digitv2.lightTheme.generic-divider);

Expand Down Expand Up @@ -247,6 +263,18 @@
border: 0.063rem solid theme(digitv2.lightTheme.alert-error);
}
}

&.single.imageFile{
width: 100%;

img{
width: 100% !important;
}

.overlay{
width: 100% !important;
}
}
}

.preview-container.uploadImage.singleUpload {
Expand All @@ -260,16 +288,21 @@
}
}

@media (min-width: 30.063rem) and (max-width: 47.938rem) {
min-width: 20.75rem;
}

@media (max-width: 30rem) {
min-width: 18rem;
}

@media (min-width: 48rem) {
min-width: 20.75rem;
&:not(.uploadImage){
@media (min-width: 30.063rem) and (max-width: 47.938rem) {
max-width: 27.5rem;
min-width: 21rem;
}

@media (max-width: 30rem) {
max-width: 20.563rem;
min-width: 18rem;
}

@media (min-width: 48rem) {
max-width: 37.5rem;
min-width: 20.75rem;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion react/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
rel='stylesheet' type='text/css'>
<link
rel="stylesheet"
href="https://unpkg.com/@egovernments/[email protected].6/dist/index.css"
href="https://unpkg.com/@egovernments/[email protected].9/dist/index.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
Expand Down
2 changes: 1 addition & 1 deletion react/modules/Project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.2-beta.8",
"@egovernments/digit-ui-components": "0.0.2-beta.9",
"lodash": "^4.17.21",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion react/modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.8",
"@egovernments/digit-ui-components": "0.0.2-beta.9",
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion react/modules/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.2-beta.8",
"@egovernments/digit-ui-components": "0.0.2-beta.9",
"react": "17.0.2",
"react-date-range": "^1.4.0",
"react-dom": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
"@babel/plugin-syntax-jsx": "^7.24.1",
"@babel/preset-react": "^7.24.1",
"@egovernments/digit-ui-libraries": "1.8.2-beta.1",
"@egovernments/digit-ui-components-css":"0.0.2-beta.8",
"@egovernments/digit-ui-components-css":"0.0.2-beta.9",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-project": "0.3.4",
"@egovernments/digit-ui-module-sample": "0.0.1",
"@egovernments/digit-ui-react-components": "1.7.10",
"@egovernments/digit-ui-svg-components": "1.0.4",
"@egovernments/digit-ui-components": "0.0.2-beta.8",
"@egovernments/digit-ui-components": "0.0.2-beta.9",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "4.0.0",
"css-loader": "5.2.6",
Expand Down
4 changes: 4 additions & 0 deletions react/ui-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.2-beta.9] - 2024-06-25
### New Changes
- Updated Uploader preview

## [0.0.2-beta.8] - 2024-06-24
### New Changes
- Added Title prop for Button
Expand Down
4 changes: 2 additions & 2 deletions react/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-components",
"version": "0.0.2-beta.8",
"version": "0.0.2-beta.9",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down Expand Up @@ -51,7 +51,7 @@
"dist"
],
"dependencies": {
"@egovernments/digit-ui-components-css": "0.0.2-beta.6",
"@egovernments/digit-ui-components-css": "0.0.2-beta.9",
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",
"@egovernments/digit-ui-svg-components": "1.0.4",
"@googlemaps/js-api-loader": "1.13.10",
Expand Down
14 changes: 10 additions & 4 deletions react/ui-components/src/atoms/UploadImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,20 @@ const UploadImage = ({
<div className="upload-image-label">{"Click to add photo"}</div>
</div>
)}
<div className="digit-img-container">
<div
className={`digit-img-container ${"uploadImage"} ${
!multiple ? "singleUpload" : ""
}`}
>
{previews.map((preview, index) => {
return (
<Fragment key={`preview-${index}`}>
<div
className={`preview-container uploadImage ${!multiple ? "singleUpload" : ""} ${
uploadedFilesCount > 1 ? " multiple" : ""
} ${preview?.error ? "error" : ""}`}
className={`preview-container uploadImage ${
!multiple ? "singleUpload" : ""
} ${
uploadedFilesCount > 1 ? " multiple" : "single"
} ${"imageFile"} ${preview?.error ? "error" : ""}`}
>
<div
onClick={() => {
Expand Down
6 changes: 3 additions & 3 deletions react/ui-components/src/atoms/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ const Uploader = (props) => {
<Fragment key={index}>
<div
className={`preview-container ${
uploadedFilesCount > 1 ? " multiple" : ""
} ${isError ? "error" : ""}`}
uploadedFilesCount > 1 ? " multiple" : "single"
} ${file?.type.startsWith("image/") ? "imageFile" : ""} ${isError ? "error" : ""}`}
>
<div
onClick={() => {
Expand All @@ -441,7 +441,7 @@ const Uploader = (props) => {
)}
</div>
<div
className={`overlay ${isError ? "error" : ""}`}
className={`overlay ${isError ? "error" : ""} ${props?.multiple ? "multiple" : "single"}`}
onClick={() => {
handleFileClick(index, file);
}}
Expand Down
10 changes: 10 additions & 0 deletions react/ui-components/src/atoms/stories/Uploader.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ UploadPopupWithValidationsWithErrorCard.args = {
showReUploadButton: true,
};

export const UploadPopupWithError = Template.bind({});
UploadPopupWithError.args = {
uploadedFiles: [],
variant: "uploadPopup",
showDownloadButton: true,
showReUploadButton: true,
multiple: false,
iserror:"Component level error!"
};

export const UploadImage = Template.bind({});
UploadImage.args = {
uploadedFiles: [],
Expand Down

0 comments on commit 6318a3e

Please sign in to comment.