Skip to content

Commit 425b67e

Browse files
authored
feat: remove "optional" tag (#87)
* feat: remove "optional" tag from validations * fix: required tag color in dark mode
1 parent f40a5a4 commit 425b67e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/components/__tests__/Validations.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Validations component', () => {
1818
test('should exclude deprecated from general validations', () => {
1919
const wrapper = shallow(<Validations required={false} validations={validations} />).find(Popover);
2020

21-
expect(shallow(wrapper.prop('target') as React.ReactElement)).toHaveText('optional+2');
21+
expect(shallow(wrapper.prop('target') as React.ReactElement)).toHaveText('+2');
2222
expect(shallow(wrapper.prop('content') as React.ReactElement)).toHaveText('format:"email"minLength:2');
2323
});
2424

src/components/shared/Validations.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { safeStringify } from '@stoplight/json';
22
import { Dictionary } from '@stoplight/types';
33
import { Popover } from '@stoplight/ui-kit';
4-
import cn from 'classnames';
54
import * as React from 'react';
65
import { ViewModeContext } from '../JsonSchemaViewer';
76

@@ -18,9 +17,9 @@ export const Validations: React.FunctionComponent<IValidations> = ({
1817
const validationCount = Object.keys(validations).length;
1918

2019
const requiredElem = (
21-
<div className={cn('ml-2', required ? 'font-medium' : 'text-darken-7 dark:text-lighten-6')}>
22-
{required ? 'required' : 'optional'}
23-
{validationCount ? `+${validationCount}` : ''}
20+
<div>
21+
{required && <span className="ml-2 text-orange-7 dark:text-orange-6">required</span>}
22+
{validationCount ? <span className="ml-1 text-darken-7 dark:text-lighten-6">+{validationCount}</span> : null}
2423
</div>
2524
);
2625

0 commit comments

Comments
 (0)