HubSpot / cms-theme-boilerplate

A straight-forward starting point for building a great website on the HubSpot CMS
https://boilerplate.hubspotcms.com
Other
355 stars 355 forks source link

Button module's corner radius field does not apply when set to 0px #417

Closed StephanieOG closed 2 years ago

StephanieOG commented 2 years ago

Description

On the Button module, when the Style > Corner > Radius field is set to "0px", it will default to the theme button radius instead. So if the user has set all buttons on the theme to be rounded but wants a 0px radius on this particular button module, it will not apply.

The reason is because the condition is set as {% if module.styles.corner.radius %} which excludes 0. Instead, it should be set to {% if module.styles.corner.radius >= 0 %}

Expected behavior

When the user sets the button module radius to 0px, it should have a sharp, 0px radius. Module style settings should override theme style settings.

To Reproduce

Steps to reproduce the behavior:

  1. On the boilerplate theme, go to Theme Settings > Buttons > Corner and give buttons a radius (e.g. 16px)
  2. On a page, drag in the Button module and go to Styles > Corner
  3. If the radius is set to 0px, it'll default to the 16px from the theme settings instead of 0px

Screenshots/source code

button-border-radius

On cms-theme-boilerplate/src/modules/button.module/module.html, update {% if module.styles.corner.radius %} to {% if module.styles.corner.radius >= 0 %}

Device information

N/A

Additional context

N/A

Checklist