Skip to content

Commit

Permalink
feat(Avatar) replace border with isBordered
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik-Petrik committed Feb 19, 2024
1 parent 3d190be commit 3695018
Show file tree
Hide file tree
Showing 6 changed files with 1,480 additions and 1,419 deletions.
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%
```

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",
}]
},
]
});

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.',
},
},
}),
};

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"} />
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 />
Loading

0 comments on commit 3695018

Please sign in to comment.