Skip to content

Commit

Permalink
feat: uploader 样式优化以及上传同事位置调整
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy committed Jun 21, 2023
1 parent b502aef commit 3206e5e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
3 changes: 3 additions & 0 deletions packages/quarkd/src/uploader/demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
quark-button {
margin-left: 10px;
}
quark-uploader {
--uploader-border-width: 0px;
}
.closeimg{
--uploader-delete-top: 0px;
--uploader-delete-right: 0px;
Expand Down
51 changes: 28 additions & 23 deletions packages/quarkd/src/uploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,31 +284,13 @@ class QuarkUploader extends QuarkElement {
const { capture, accept, multiple, name, id, disabled } = this;
const hiddenUpload = this.tasks.length >= Number(this.maxcount);
const showTasks = this.preview ? this.tasks.slice(0, this.maxcount) : [];
const uploaderClasses = [
"quark-uploader",
disabled && "uploader-disabled",
this.preview && showTasks.length && "quark-uploader-mg",
];
return (
<Fragment>
{!this.readonly && (
<div
class={`quark-uploader ${disabled && "uploader-disabled"}`}
style={{ display: !hiddenUpload ? "block" : "none" }}
>
<slot name="uploader">
<div class="quark-uploader-icon">
<quark-icon-camera-fill size="32" color={this.iconcolor} />
</div>
</slot>
<input
ref={this.inputRef}
name={name}
id={id}
type="file"
accept={accept}
multiple={multiple}
capture={capture}
onchange={this.onChange}
disabled={disabled}
/>
</div>
)}
{showTasks.map((item, index, n) => (
<div class="quark-uploader-preview-item" key={item.id}>
{item.status === "uploading" && (
Expand Down Expand Up @@ -337,6 +319,29 @@ class QuarkUploader extends QuarkElement {
)}
</div>
))}
{!this.readonly && (
<div
class={uploaderClasses.join(" ")}
style={{ display: !hiddenUpload ? "block" : "none" }}
>
<slot name="uploader">
<div class="quark-uploader-icon">
<quark-icon-camera-fill size="32" color={this.iconcolor} />
</div>
</slot>
<input
ref={this.inputRef}
name={name}
id={id}
type="file"
accept={accept}
multiple={multiple}
capture={capture}
onchange={this.onChange}
disabled={disabled}
/>
</div>
)}
</Fragment>
);
}
Expand Down
7 changes: 4 additions & 3 deletions packages/quarkd/src/uploader/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
justify-content: center;
flex-direction: column;
cursor: pointer;
margin: 0 var(--uploader-margin, 6px) var(--uploader-margin, 6px) 0;
}

:host .quark-uploader-mg {
/* margin-right: var(--uploader-margin, 6px); */
}
:host .quark-uploader-icon {
box-sizing: border-box;
width: var(--uploader-width, 93px);
height: var(--uploader-height, 93px);
background: var(--uploader-background);
background: var(--uploader-background, #f7f8fa);
border-width: var(--uploader-border-width, 1px);
border-color: var(--uploader-border-color, #e1e6eb);
border-style: var(--uploader-border-style, dashed);
Expand Down

0 comments on commit 3206e5e

Please sign in to comment.