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(Upload): display files without anchor when their size is not given #4390

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Dec 12, 2024

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 3:22pm

Copy link

codesandbox-ci bot commented Dec 12, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

@langz langz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🎸

@tujoworker tujoworker force-pushed the fix/forms-upload-empty-file branch 4 times, most recently from 1dc796f to 5eee87b Compare December 12, 2024 13:57
@tujoworker tujoworker requested a review from langz December 12, 2024 13:58
@tujoworker tujoworker marked this pull request as ready for review December 12, 2024 13:58

### Display files as non-clickable

When file size is 0, the file is displayed as a span instead of an anchor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?
Because there's no file if file size is 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new File([], name, { type }) will create a file with the size 0 when downloading it. But a file with the size of 0 is not valid. So then we "show" just the name, but do now allow it to be downloaded or displayed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We could perhaps state this reason in the docs as well🤌

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And perhaps something about that if providing onFileClick, it will display a button no matter what the file size is.

@langz langz force-pushed the fix/forms-upload-empty-file branch from d994fad to 02b453d Compare December 13, 2024 15:06
@langz
Copy link
Contributor

langz commented Dec 13, 2024

I rebased this with latest main now.

@langz langz merged commit 70df7c8 into main Dec 13, 2024
10 checks passed
@langz langz deleted the fix/forms-upload-empty-file branch December 13, 2024 15:40
tujoworker pushed a commit that referenced this pull request Dec 13, 2024
## [10.61.0](v10.60.1...v10.61.0) (2024-12-13)

### 📝 Documentation

* add guidelines for writing commit messages to the contribution guide ([#4389](#4389)) ([34eff0e](34eff0e))
* **Upload:** add `id` property ([#4401](#4401)) ([56d4956](56d4956))

### ✨ Features

* **Forms:** add missing support for `defaultValue` for Field.Slider ([#4394](#4394)) ([701ab66](701ab66))
* **Logo:** update sbanken logo ([#4379](#4379)) ([069ae1a](069ae1a))
* **Upload:** make `id` property as optional ([#4405](#4405)) ([0c58973](0c58973))
* **Value.Upload:** add async `onFileClick` event ([#4397](#4397)) ([be1c21c](be1c21c))

### 🐛 Bug Fixes

* **DatePicker:** add `null` as possible date type as return value ([#4407](#4407)) ([363e0b5](363e0b5))
* **DatePicker:** throw error when `date` is invalid ([#4396](#4396)) ([f977ebc](f977ebc))
* **FieldBlock:** remove max-width for label when width stretch ([#4406](#4406)) ([20c02d4](20c02d4))
* **Forms:** enhance transformIn and transformOut to support changed array and object instances ([#4392](#4392)) ([ae4648a](ae4648a)), closes [#4366](#4366)
* **Slider:** ensure `min` and `max` value is respected when `step` doesn't fit exactly ([#4395](#4395)) ([2c00b0c](2c00b0c))
* **Tabs:** ensure cached content never takes up visual space ([#4399](#4399)) ([360aacc](360aacc))
* **Upload:** display files without anchor when their size is not given ([#4390](#4390)) ([70df7c8](70df7c8))
* **Upload:** display spinner in async `onFileClick` without file `id` ([#4393](#4393)) ([b743d6e](b743d6e))
@tujoworker
Copy link
Member Author

🎉 This PR is included in version 10.61.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants