Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(file-dropzone): improve examples #2835

Merged
merged 1 commit into from
Mar 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ export class FileDropzoneTypeFilteringExample {
@State()
private files: FileInfo[] = [];

@State()
private required = false;

@State()
private disabled = false;

@State()
private readonly = false;

@State()
private value: string;

@State()
private rejectedFiles: FileInfo[] = [];

public render() {
const MAX_LENGTH = 500;

return [
<limel-file-dropzone
onFilesSelected={this.handleAcceptedFiles}
Expand All @@ -41,6 +55,12 @@ export class FileDropzoneTypeFilteringExample {
type="textarea"
placeholder="What is your dream pet? Describe it here and attach a picture of it."
helperText="To attach files, simply drag & drop them here!"
maxlength={MAX_LENGTH}
value={this.value}
required={this.required}
onChange={this.handleChange}
disabled={this.disabled}
readonly={this.readonly}
/>
</limel-file-dropzone>,
<limel-file-dropzone
Expand All @@ -62,6 +82,10 @@ export class FileDropzoneTypeFilteringExample {
];
}

private handleChange = (event: CustomEvent<string>) => {
this.value = event.detail;
};

private handleAcceptedFiles = (event: CustomEvent<FileInfo[]>) => {
this.files = [...this.files.concat(event.detail)];
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/file-dropzone/examples/file-dropzone.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
limel-file-dropzone {
height: 2.25rem;
height: 3rem;
background-color: rgb(var(--contrast-300));
border-radius: 0.5rem;
border-radius: 0.25rem;
border: 1px solid rgb(var(--contrast-800));
margin-bottom: 0.5rem;
}
Expand Down
Loading