From 08c5afcf60eb77307052ab06d5cfe745143fe0f8 Mon Sep 17 00:00:00 2001 From: Abbey Hart <abbeyhrt@gmail.com> Date: Mon, 7 Mar 2022 15:11:31 -0600 Subject: [PATCH] fix(react): removes v11 enabled check on ${prefix}--label and adjusts styles (#10918) * fix(react): removes v11 flag check for cds--label class * fix(styles): removes v11 check in v11 styles and makes margin-bottom 0 * fix(styles): remove extraneous v11 checks * fix(styles): add back in margin and no-margin class Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../react/src/components/FormLabel/FormLabel.js | 14 +++++++------- packages/styles/scss/components/form/_form.scss | 16 ++-------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/packages/react/src/components/FormLabel/FormLabel.js b/packages/react/src/components/FormLabel/FormLabel.js index d29b5dc3c178..8be6ea9509b2 100644 --- a/packages/react/src/components/FormLabel/FormLabel.js +++ b/packages/react/src/components/FormLabel/FormLabel.js @@ -7,28 +7,28 @@ import PropTypes from 'prop-types'; import React from 'react'; -import classnames from 'classnames'; +import cx from 'classnames'; import { usePrefix } from '../../internal/usePrefix'; import * as FeatureFlags from '@carbon/feature-flags'; -const FormLabel = ({ className, children, id, ...other }) => { +function FormLabel({ className: customClassName, children, id, ...rest }) { const prefix = usePrefix(); - const classNames = classnames( + const className = cx( + `${prefix}--label`, { - [`${prefix}--label`]: !FeatureFlags.enabled('enable-v11-release'), [`${prefix}--label--no-margin`]: FeatureFlags.enabled( 'enable-v11-release' ), }, - className + customClassName ); return ( - <label htmlFor={id} className={classNames} {...other}> + <label htmlFor={id} className={className} {...rest}> {children} </label> ); -}; +} FormLabel.propTypes = { /** diff --git a/packages/styles/scss/components/form/_form.scss b/packages/styles/scss/components/form/_form.scss index 827f75fd3990..1825918b127c 100644 --- a/packages/styles/scss/components/form/_form.scss +++ b/packages/styles/scss/components/form/_form.scss @@ -21,16 +21,6 @@ $input-label-weight: 400 !default; @mixin form { .#{$prefix}--fieldset { @include reset; - - @if not enabled('enable-v11-release') { - margin-bottom: $spacing-07; - } - } - - @if not enabled('enable-v11-release') { - .#{$prefix}--fieldset--no-margin { - margin-bottom: 0; - } } .#{$prefix}--form-item { @@ -57,10 +47,8 @@ $input-label-weight: 400 !default; vertical-align: baseline; } - @if enabled('enable-v11-release') { - .#{$prefix}--label--no-margin { - margin-bottom: 0; - } + .#{$prefix}--label--no-margin { + margin-bottom: 0; } .#{$prefix}--label .#{$prefix}--tooltip__trigger {