bigbite / themer

GNU General Public License v2.0
2 stars 0 forks source link

[BBT-93]: Outline UI component #23

Closed Joe-Rouse closed 1 year ago

Joe-Rouse commented 1 year ago

Description

Completes BBT-93 - This PR adds a reusable outline component to the plugin. The component allows you to set 4 outline properties:

Similar to #22, I've limited the available units you can use for width & offset as some commonly used units aren't supported (e.g. %). If an unsupported unit is used, it defaults to px.

Change Log

Steps to test

Screenshots/Videos

Importing from theme.json

https://github.com/bigbite/themer/assets/45216035/4e2dc49d-be1b-436c-a321-0a4aed5b29ed

Changing values

https://github.com/bigbite/themer/assets/45216035/14af22e7-10b6-4eec-9662-b86644b3e757

Exporting changes

https://github.com/bigbite/themer/assets/45216035/98094b1c-5c48-4cc6-8f31-9d636964b374

Checklist:

Joe-Rouse commented 1 year ago

@g-elwell This issue should be resolved now.

I've changed the isCssLengthUnit helper so that it can accept an optional - at the start of the string. I'm also checking the UnitControl for an empty string rather than a falsy value before defaulting it back to 0px.

I've added a min value to the width UnitControl component so that you can't add a negative value into it.

Video of negative value for offset & non-negative value for width working: http://bigbite.im/v/X82COK

Joe-Rouse commented 1 year ago

@g-elwell I've also just pushed another commit which adds i18n to the select control labels as I just noticed that was missing.

spbuckle commented 1 year ago

@Joe-Rouse @g-elwell Do you think the BorderControl component would streamline this up a bit in terms of the UI? It has an input for the width but also includes the colour palette within that.

Before

before

After

after after-open

g-elwell commented 1 year ago

@spbuckle I like the UI improvement, if it's straight up compatible then I'd be up for switching over, if there are any complications (I don't think there will be?) I'd push til later

Joe-Rouse commented 1 year ago

@spbuckle The only concern I have with this is that there's no prop to control the units available to select. By default you can select % as a unit but this isn't valid CSS.