-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Avatar) replace border with isBordered
- Loading branch information
1 parent
3d190be
commit 3695018
Showing
6 changed files
with
1,480 additions
and
1,419 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...les/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
### avatar-replace-border-for-isBordered [(#9954)](https://github.com/patternfly/patternfly-react/pull/9954) | ||
|
||
border prop has been removed since light and dark borders are no longer supported. isBordered prop was added to add a border to avatar. | ||
|
||
#### Examples | ||
|
||
In: | ||
|
||
```jsx | ||
%inputExample% | ||
``` | ||
|
||
Out: | ||
|
||
```jsx | ||
%outputExample% | ||
``` | ||
|
24 changes: 24 additions & 0 deletions
24
...rc/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const ruleTester = require('../../ruletester'); | ||
import * as rule from './avatar-replace-border-for-isBordered'; | ||
|
||
ruleTester.run("avatar-replace-border-for-isBordered", rule, { | ||
valid: [ | ||
{ | ||
code: `<Avatar border={"dark"} />` | ||
}, | ||
{ | ||
code: `import { Avatar } from '@patternfly/react-core'; <Avatar someOtherProp />` | ||
} | ||
], | ||
invalid: [ | ||
{ | ||
code: `import { Avatar } from '@patternfly/react-core'; <Avatar border={"dark"} />`, | ||
output: `import { Avatar } from '@patternfly/react-core'; <Avatar isBordered />`, | ||
errors: [{ | ||
message: `border prop has been removed since light and dark borders are no longer supported. isBordered prop was added to add a border to avatar.`, | ||
type: "JSXOpeningElement", | ||
}] | ||
}, | ||
] | ||
}); | ||
|
17 changes: 17 additions & 0 deletions
17
...ods/src/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getFromPackage, renameProps } from '../../helpers'; | ||
|
||
// https://github.com/patternfly/patternfly-react/pull/9954 | ||
module.exports = { | ||
meta: { fixable: 'code' }, | ||
create: renameProps({ | ||
Avatar: { | ||
"border": { | ||
newName: "isBordered", | ||
replace: true, | ||
message: () => | ||
'border prop has been removed since light and dark borders are no longer supported. isBordered prop was added to add a border to avatar.', | ||
}, | ||
}, | ||
}), | ||
}; | ||
|
3 changes: 3 additions & 0 deletions
3
...s/src/rules/v6/avatarReplaceBorderForIsBordered/avatarReplaceBorderForIsBorderedInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Avatar } from "@patternfly/react-core"; | ||
|
||
export const AvatarReplaceBorderForIsBorderedInput = () => <Avatar border={"dark"} /> |
3 changes: 3 additions & 0 deletions
3
.../src/rules/v6/avatarReplaceBorderForIsBordered/avatarReplaceBorderForIsBorderedOutput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Avatar } from "@patternfly/react-core"; | ||
|
||
export const AvatarReplaceBorderForIsBorderedInput = () => <Avatar isBordered /> |
Oops, something went wrong.