fix upload

This commit is contained in:
rizky 2024-07-29 18:25:20 -07:00
parent c3bb624d25
commit 04dca7fa96
1 changed files with 47 additions and 30 deletions

View File

@ -119,11 +119,25 @@ export const FieldUpload: FC<{
input.ref.value = null; input.ref.value = null;
} }
}; };
if (isEditor) input.fase = "start";
return ( return (
<div className="c-flex-grow c-flex-row c-flex c-w-full c-h-full c-items-stretch"> <div className="c-flex-grow c-flex-row c-flex c-w-full c-h-full c-items-stretch">
{input.fase === "start" ? ( {input.fase === "start" ? (
<> <>
<div className="c-flex c-flex-row c-relative c-flex-grow c-items-center"> <div
className={cx(
"c-flex c-flex-row c-relative c-flex-grow c-items-center c-cursor-pointer hover:c-bg-blue-50",
css`
input[type="file"],
input[type="file"]::-webkit-file-upload-button {
cursor: pointer;
}
`
)}
>
{!isEditor && (
<input <input
ref={(ref) => (input.ref = ref)} ref={(ref) => (input.ref = ref)}
type="file" type="file"
@ -133,7 +147,8 @@ export const FieldUpload: FC<{
"c-absolute c-w-full c-h-full c-cursor-pointer c-top-0 c-left-0 c-opacity-0" "c-absolute c-w-full c-h-full c-cursor-pointer c-top-0 c-left-0 c-opacity-0"
)} )}
/> />
{styling === "inline" ? ( )}
{styling !== "full" ? (
<> <>
<div <div
onClick={() => { onClick={() => {
@ -148,7 +163,7 @@ export const FieldUpload: FC<{
<Upload className="c-h-4 c-w-4" /> <Upload className="c-h-4 c-w-4" />
</div> </div>
<div className="c-flex c-flex-row c-items-center"> <div className="c-flex c-flex-row c-items-center">
Upload Your File Upload File
</div> </div>
</div> </div>
</> </>
@ -281,6 +296,7 @@ const Filename = ({ url }: { url: string }) => {
const color = darkenColor(generateRandomColor(file.extension)); const color = darkenColor(generateRandomColor(file.extension));
return ( return (
<> <>
{file.extension && (
<div <div
className={cx( className={cx(
css` css`
@ -298,6 +314,7 @@ const Filename = ({ url }: { url: string }) => {
> >
{file.extension} {file.extension}
</div> </div>
)}
<div <div
className={cx( className={cx(
css` css`
@ -305,7 +322,7 @@ const Filename = ({ url }: { url: string }) => {
` `
)} )}
> >
Open in New Tab View File in New Tab
</div> </div>
</> </>
); );