-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app) refactor and add components for nice edit
- Loading branch information
1 parent
128ba13
commit 936d641
Showing
13 changed files
with
136 additions
and
183 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
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
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
'use client'; | ||
import React from 'react'; | ||
|
||
import { Card, Typography } from '@material-tailwind/react'; | ||
|
||
|
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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react'; | ||
import { ChangeEvent, FocusEvent, ReactNode } from 'react'; | ||
|
||
export interface ICustomInput { | ||
label: string; | ||
name: string; | ||
type?: string; | ||
icon?: React.ReactNode; | ||
icon?: ReactNode; | ||
step?: string; | ||
onBlur: (e: React.FocusEvent<HTMLInputElement>) => void; | ||
onBlur: (e: FocusEvent<HTMLInputElement>) => void; | ||
value: string; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
onChange: (e: ChangeEvent<HTMLInputElement>) => void; | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/components/CustomUploadCarousel/CustomUploadCarousel.tsx
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 @@ | ||
import { FC } from 'react'; | ||
|
||
import Image from 'next/image'; | ||
import { Carousel } from '@material-tailwind/react'; | ||
|
||
import CustomArrow from '@/components/CustomArrow/CustomArrow'; | ||
import { Typography } from '@/providers/ThemeProvider'; | ||
|
||
export interface IImageCarousel { | ||
imagePreviews: string[]; // Assuming imagePreviews is an array of strings (URLs) | ||
} | ||
|
||
const CustomUploadCarousel: FC<IImageCarousel> = ({ imagePreviews }) => { | ||
return ( | ||
<div> | ||
<Typography variant="small"> | ||
Podgląd obrazków został dostosowany do szerokości formularza | ||
</Typography> | ||
<Carousel | ||
className="rounded-xl" | ||
prevArrow={({ handlePrev, firstIndex }) => ( | ||
<CustomArrow onClick={handlePrev} direction="prev" isDisabled={firstIndex} /> | ||
)} | ||
nextArrow={({ handleNext, activeIndex }) => ( | ||
<CustomArrow | ||
onClick={handleNext} | ||
direction="next" | ||
isDisabled={activeIndex === imagePreviews.length - 1} | ||
/> | ||
)} | ||
> | ||
{imagePreviews.map((img, i) => ( | ||
<Image | ||
width={0} | ||
height={0} | ||
sizes="100vw" | ||
style={{ width: '100%' }} | ||
src={img} | ||
alt={'image-' + i} | ||
key={i} | ||
className="object-cover h-48 w-96" | ||
/> | ||
))} | ||
</Carousel> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CustomUploadCarousel; |
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,40 @@ | ||
import { ChangeEvent, FC } from 'react'; | ||
import { ErrorMessage } from 'formik'; | ||
|
||
import UploadIcon from '@/dodajProdukt/UploadIcon'; | ||
|
||
interface IDropzone { | ||
name?: string; | ||
onSelectFile: (e: ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
const Dropzone: FC<IDropzone> = ({ name = '', onSelectFile }) => ( | ||
<div className="flex flex-wrap items-center justify-center "> | ||
<ErrorMessage name={name} component="div" className="w-full" /> | ||
<label | ||
htmlFor="dropzone-file" | ||
className="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600" | ||
> | ||
<div className="flex flex-col items-center justify-center pt-5 pb-6 "> | ||
<UploadIcon /> | ||
<p className="text-sm mb-2 text-gray-500 dark:text-gray-400 text-center"> | ||
<span className="font-semibold">Kliknij by dodać obrazek</span> albo przeciągnij i upuść | ||
</p> | ||
<p className="text-xs text-gray-500 dark:text-gray-400 text-center"> | ||
SVG, PNG, JPG bądź GIF (MAX. 800x400px) | ||
</p> | ||
</div> | ||
<input | ||
onChange={(e) => onSelectFile(e)} | ||
id="dropzone-file" | ||
name={name} | ||
type="file" | ||
className="hidden" | ||
accept=".jpg,.png,.svg,.gif" | ||
// multiple | ||
/> | ||
</label> | ||
</div> | ||
); | ||
|
||
export default Dropzone; |
Oops, something went wrong.