Skip to content

Commit

Permalink
Revert "feat!: remove weak prop from Text and add codemod for it (#374)"
Browse files Browse the repository at this point in the history
This reverts commit df98bb9.
  • Loading branch information
martimalek authored Sep 29, 2023
1 parent 07ca1f9 commit 4ee2731
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 162 deletions.
10 changes: 0 additions & 10 deletions docs/migrating.storybook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ This won't change how your icons look in any way since we already exported the d
npx jscodeshift -t node_modules/@freenow/wave/lib/cjs/codemods/deprecated-icons.js path/to/src
```

### Text weak property

The `weak` property was the initial way to indicate secondary information in a `Text` component, it has been deprecated for a while in favour of
the more semantic `secondary` prop.

```bash
npx jscodeshift -t node_modules/@freenow/wave/lib/cjs/codemods/weak-to-secondary.js path/to/src
```

### Tooltip placement property

In a previous minor release we swapped our positioning engine from `react-tether` to `react-popper`, this came with changes in the placement options
Expand All @@ -75,4 +66,3 @@ npx jscodeshift -t node_modules/@freenow/wave/lib/cjs/codemods/tooltip-placement
You can find the mappings in the following table:

<PlacementMappingsTable />

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from '@freenow/wave';
import React from 'react';

export const ButtonTest = (): JSX.Element => (
<Button width='100%' mr="1" mt="3" disabled>
<Button width="100%" mr="1" mt="3" disabled>
Clone
</Button>
);

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions src/codemods/__tests__/weak-to-secondary-test.ts

This file was deleted.

67 changes: 0 additions & 67 deletions src/codemods/weak-to-secondary.ts

This file was deleted.

14 changes: 12 additions & 2 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from 'styled-system';
import { theme } from '../../essentials/theme';
import { get } from '../../utils/themeGet';
import { deprecatedProperty } from '../../utils/deprecatedProperty';
import { getSemanticValue } from '../../utils/cssVariables';

interface TextProps
Expand All @@ -32,6 +33,11 @@ interface TextProps
* Adjust color for display on a dark background
*/
inverted?: boolean;
/**
* Adjust color to indicate secondary information
* @deprecated use `secondary` instead
*/
weak?: boolean;
/**
* Adjust color to indicate secondary information
*/
Expand All @@ -43,12 +49,16 @@ interface TextProps
}

function determineTextColor(props: TextProps) {
const { secondary, inverted, disabled } = props;
const { weak, secondary, inverted, disabled } = props;
if (weak !== undefined) {
deprecatedProperty('Text', weak, 'weak', 'secondary', 'Rename `weak` to `secondary` to remove the warning.');
}

if (disabled) {
return getSemanticValue('foreground-disabled');
}

if (secondary) {
if (secondary || weak) {
return getSemanticValue(inverted ? 'foreground-neutral-faded' : 'foreground-neutral-emphasized');
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/Text/docs/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const meta: Meta = {
disable: true
}
},
weak: {
table: {
disable: true
}
}
},
args: {
children: 'Sign up to FREENOW'
Expand Down

0 comments on commit 4ee2731

Please sign in to comment.