writer / writer-framework

No-code in the front, Python in the back. An open-source framework for creating data apps.
https://dev.writer.com/framework/introduction
Apache License 2.0
1.3k stars 73 forks source link

feat(ui): improve `CoreFileInput` #494

Closed madeindjs closed 3 weeks ago

madeindjs commented 1 month ago

The main issue of CoreFileInput was that, when it re-render, the files selected label is cleared and there is no way to set it again.

To prevent that, the easiest way is to hide the <input type="file" /> and display instead a custom button and a label.

This unlock a cool possibility to create the link of the file and let the user download the file.

Screencast from 2024-07-18 23-00-18.webm

ramedina86 commented 1 month ago

I like the logic of this one but I think the button needs to be changed.

Can we try using a plainWdsButton? By plain I mean separatorColor as border, then transparent or containerBackgroundColor for the background, primaryTextColor for the text.

From the design system:

Screenshot 2024-07-30 at 13 28 33
madeindjs commented 1 month ago

@ramedina86 , do you think we can try to reuse the WdsButton and pass CSS var to customize it ?

It seems a bit hard for now though, the border and background can't be separated for instance

https://github.com/writer/writer-framework/blob/37b25b1bafcddbbe0909ca9482620273ad1a9fb4/src/ui/src/wds/WdsButton.vue#L15-L16

ramedina86 commented 1 month ago

@madeindjs please implement a variant prop, we'll need it anyway. If you check WDS we have several variants, so it makes sense to make it user-configurable for other buttons.

ramedina86 commented 1 month ago

Unsure if I was 100% clear, it'd work like

<WdsButton variant="primary">Button that looks like today</WdsButton>
<WdsButton variant="tertiary">Button that's neutral<WdsButton>
madeindjs commented 1 month ago

@ramedina86 , It's done

ramedina86 commented 3 weeks ago

Nice, looks really good!