From 49b8dcb25ddf5404f5940602b1c915fdcab0a102 Mon Sep 17 00:00:00 2001 From: Dhruv <79097544+dhruvv173@users.noreply.github.com> Date: Tue, 23 May 2023 23:10:34 +0530 Subject: [PATCH] Moving `RESIZE` constant to textarea component folder (#19240) * Moving RESIZE constant * fixinf linting errors --- ui/components/ui/textarea/textarea.constants.js | 8 ++++++++ ui/components/ui/textarea/textarea.js | 7 +++---- ui/components/ui/textarea/textarea.stories.js | 7 +++---- ui/components/ui/textarea/textarea.test.js | 2 +- ui/helpers/constants/design-system.ts | 9 --------- 5 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 ui/components/ui/textarea/textarea.constants.js diff --git a/ui/components/ui/textarea/textarea.constants.js b/ui/components/ui/textarea/textarea.constants.js new file mode 100644 index 000000000000..d03c76d18c48 --- /dev/null +++ b/ui/components/ui/textarea/textarea.constants.js @@ -0,0 +1,8 @@ +export const RESIZE = { + NONE: 'none', + BOTH: 'both', + HORIZONTAL: 'horizontal', + VERTICAL: 'vertical', + INITIAL: 'initial', + INHERIT: 'inherit', +}; diff --git a/ui/components/ui/textarea/textarea.js b/ui/components/ui/textarea/textarea.js index c0da41ee7753..a47a597f9a18 100644 --- a/ui/components/ui/textarea/textarea.js +++ b/ui/components/ui/textarea/textarea.js @@ -4,15 +4,14 @@ import PropTypes from 'prop-types'; import classnames from 'classnames'; import { - RESIZE, BorderStyle, - BLOCK_SIZES, + BlockSize, Size, BorderColor, BackgroundColor, } from '../../../helpers/constants/design-system'; - import Box from '../box'; +import { RESIZE } from './textarea.constants'; const TextArea = ({ className, @@ -40,7 +39,7 @@ const TextArea = ({ borderRadius={Size.SM} borderStyle={BorderStyle.solid} padding={4} - width={BLOCK_SIZES.FULL} + width={BlockSize.Full} {...boxProps} > {(boxClassName) => ( diff --git a/ui/components/ui/textarea/textarea.stories.js b/ui/components/ui/textarea/textarea.stories.js index 8740fc5e713a..671ae917c840 100644 --- a/ui/components/ui/textarea/textarea.stories.js +++ b/ui/components/ui/textarea/textarea.stories.js @@ -2,14 +2,13 @@ import React from 'react'; import { useArgs } from '@storybook/client-api'; import { - RESIZE, BorderStyle, - BLOCK_SIZES, + BlockSize, BorderRadius, BorderColor, Size, } from '../../../helpers/constants/design-system'; - +import { RESIZE } from './textarea.constants'; import README from './README.mdx'; import Textarea from '.'; @@ -115,6 +114,6 @@ Scrollable.args = { borderRadius: BorderRadius.none, borderStyle: BorderStyle.none, padding: [2, 4], - width: BLOCK_SIZES.FULL, + width: BlockSize.Full, }, }; diff --git a/ui/components/ui/textarea/textarea.test.js b/ui/components/ui/textarea/textarea.test.js index a57dc82cb4a7..08ad254a790c 100644 --- a/ui/components/ui/textarea/textarea.test.js +++ b/ui/components/ui/textarea/textarea.test.js @@ -3,9 +3,9 @@ import { render, fireEvent } from '@testing-library/react'; import { BorderColor, BorderStyle, - RESIZE, Size, } from '../../../helpers/constants/design-system'; +import { RESIZE } from './textarea.constants'; import TextArea from '.'; describe('TextArea', () => { diff --git a/ui/helpers/constants/design-system.ts b/ui/helpers/constants/design-system.ts index e90fe6874bac..2b73cdb26871 100644 --- a/ui/helpers/constants/design-system.ts +++ b/ui/helpers/constants/design-system.ts @@ -497,13 +497,4 @@ export const SEVERITIES = { SUCCESS: 'success', }; -export const RESIZE = { - NONE: 'none', - BOTH: 'both', - HORIZONTAL: 'horizontal', - VERTICAL: 'vertical', - INITIAL: 'initial', - INHERIT: 'inherit', -}; - export const BREAKPOINTS = ['base', 'sm', 'md', 'lg'];