decap-cms
decap-cms copied to clipboard
Support prefix & suffix for 3 widgets: string, number & boolean
This changes are about:
- refactor syntax
BooleanControl
static properties - add
prefix
&suffix
options - update widget control style to match with new options
- update Boolean widget document
Summary
The update allows developers to display messages before (prefix
) and after (suffix
) the toggle. This design intends to provide a better information and look to users.
In my use case, I have a field to decide if I want to show a post in homepage. If I set "Show in homepage" string in label, the layout of input would be unbalance as the top small part is bigger than the main body. The toggle itself seems lonely as well. So if I can set "Visibility" in label
option and "Show in homepage" in prefix
option, it would be much sense.
Test plan
- Run
yarn start
- Go to this path
collections/kitchenSink/entries/a-big-entry-with-all-the-things
- Expect to see the exact Boolean input like this screenshot:
Checklist
- [x] I have read the contribution guidelines.
A picture of a cute animal (not mandatory but encouraged)
Be hold! The amazing meowman!
@ngdangtu-vn I see why you would want this feature, but it seems very similar to hint
, which exists on all widgets and can be used to explain a field in more detail. Is there a reason why you wouldn't use hint?
Is there a reason why you wouldn't use hint?
I wouldn't say I don't use hint. But my reason is simply:
- Not wasting a whole line for only 1 toggle element
- Hint text is small enough to be a hint only. Prefix/Suffix will plays nice the the role of important instruction.
- In some messages, it looks better with prefix (or|and) suffix as well. I admit, my example wasn't very good. Maybe like this:
Show author [x]
.
I even plan to do take this further to string
and number
widgets so dev can display fields like this [...]px
. Cool right?
Extending this to string and number will be useful! Can you implement that as part of this PR and I will review/merge it all together?
Update photo for recent commits
@martinjagodic Could you review my code and the Widgets' UI? Thanks.
@xaiki
Thanks for your review but I'm not sure if they still need this PR. It kinda a dead PR already.
@xaiki thanks for your reviews
@ngdangtu-vn This PR is not dead, but I understand it sitting here for a long time now. We have quite a backlog and we want to add features based on the triage we decided upon. This one is not essential so it will probably wait a bit longer.
@martinjagodic Ok it's cool, I thought the code won't be able to fit with the new Decap.
@xaiki So I will fix the PR using your advice later 'cause I'm bit busy recently & I need time to reload my memory :))
@martinjagodic if reviews help I'm happy to look at other PRs, just point me to the top of the stack.
@xaiki I will happily assign you review requests. To talk more in-depth about what to do next, please join the contributing channel on our Discord server.
@ngdangtu-vn are you still interested in moving this forward? If yes, please address the comments and solve merge conflicts. Thanks!
Ok, give me around 2 more days
Deploy request for cms-demo rejected.
Name | Link |
---|---|
Latest commit | e9c3a9ed5d273b6c048f655eac48b7208459196a |
I didn't close this? Hold on I'm reorganizing this... Maybe because I reset branch?
@ngdangtu-vn maybe. I guess you can just reopen and continue from there.
Deploy Preview for decap-www ready!
Name | Link |
---|---|
Latest commit | 2d9cb89683c74eb034cb4a00f54bbb97705070f9 |
Latest deploy log | https://app.netlify.com/sites/decap-www/deploys/659c01c495853c00082824a5 |
Deploy Preview | https://deploy-preview-6836--decap-www.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.