-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(file-upload): fix coderabbitai reported bugs and markdown
- Loading branch information
Showing
16 changed files
with
170 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
...content/components/file-upload/buttons.ts → ...omponents/file-upload/buttonsContainer.ts
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const DeleteIcon = `export const DeleteIcon = ({ | ||
fill = 'currentColor', | ||
filled, | ||
size, | ||
height, | ||
width, | ||
label, | ||
...props | ||
}) => { | ||
return ( | ||
<svg aria-hidden="true" fill="none" focusable="false" height="1em" role="presentation" | ||
viewBox="0 0 20 20" width="1em"> | ||
<path | ||
d="M17.5 4.98332C14.725 4.70832 11.9333 4.56665 9.15 4.56665C7.5 4.56665 5.85 4.64998 4.2 4.81665L2.5 4.98332" | ||
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5"></path> | ||
<path | ||
d="M7.08331 4.14169L7.26665 3.05002C7.39998 2.25835 7.49998 1.66669 8.90831 1.66669H11.0916C12.5 1.66669 12.6083 2.29169 12.7333 3.05835L12.9166 4.14169" | ||
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5"></path> | ||
<path | ||
d="M15.7084 7.61664L15.1667 16.0083C15.075 17.3166 15 18.3333 12.675 18.3333H7.32502C5.00002 18.3333 4.92502 17.3166 4.83335 16.0083L4.29169 7.61664" | ||
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5"></path> | ||
<path d="M8.60834 13.75H11.3833" stroke="currentColor" strokeLinecap="round" | ||
strokeLinejoin="round" strokeWidth="1.5"></path> | ||
<path d="M7.91669 10.4167H12.0834" stroke="currentColor" strokeLinecap="round" | ||
strokeLinejoin="round" strokeWidth="1.5"></path> | ||
</svg> | ||
); | ||
};`; | ||
|
||
const App = ` | ||
import React from "react"; | ||
import {FileUpload} from "@nextui-org/react"; | ||
import {Button} from "@nextui-org/react"; | ||
import {DeleteIcon} from './DeleteIcon'; | ||
export default function App() { | ||
const [files, setFiles] = React.useState([]); | ||
return ( | ||
<FileUpload | ||
multiple | ||
onChange={newFiles => setFiles(newFiles)} | ||
browseButton={<Button>Search</Button>} | ||
uploadButton={<Button onClick={() => console.log("Files to upload:\\n" + files.map(file => file.name).join("\\n"))}>Upload Files</Button>} | ||
addButton={<Button>+</Button>} | ||
resetButton={<Button><DeleteIcon /></Button>} | ||
/> | ||
); | ||
}`; | ||
|
||
const react = { | ||
"/App.jsx": App, | ||
"/DeleteIcon.jsx": DeleteIcon, | ||
}; | ||
|
||
export default { | ||
...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
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
30 changes: 30 additions & 0 deletions
30
packages/components/file-upload/__tests__/__snapshots__/file-upload.test.tsx.snap
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,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`FileUpload should render correctly 1`] = ` | ||
<div> | ||
<div | ||
class="flex flex-col relative overflow-hidden h-auto text-foreground box-border bg-content1 outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2" | ||
> | ||
<input | ||
class="hidden" | ||
title="file upload" | ||
type="file" | ||
/> | ||
<input | ||
class="hidden" | ||
title="single file upload" | ||
type="file" | ||
/> | ||
<div | ||
class="flex gap-3 p-3 w-full items-center overflow-hidden color-inherit subpixel-antialiased" | ||
> | ||
<button | ||
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent data-[pressed=true]:scale-[0.97] outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-4 min-w-20 h-10 text-small gap-2 rounded-medium [&>svg]:max-w-[theme(spacing.8)] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover" | ||
type="button" | ||
> | ||
Browse | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
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
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
Oops, something went wrong.