-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Placeholder): rename prop
header
to title
. Subcomponent `Hea…
…der` to `Title`, `Text` to `Description` (#7766) h2. Описание Для компонента `Placeholder` переименовал свойство `header` на`title`. А также переименовал подкомпоненты `Header` на `Title`, `Text` на `Description` h2. Release notes - Placeholder: - свойство `header` переименовано на `title` ```diff <Placeholder icon={<Icon56UsersOutline />} - header={<Button size="m">Подключить сообщества</Button>} + title={<Button size="m">Подключить сообщества</Button>} > Подключите сообщества, от которых Вы хотите получать уведомления </Placeholder> ``` - подкомпонент `Header` переименован на `Title`, `Text` переименован на `Description` ```diff <Placeholder.Container> - <Placeholder.Header> + <Placeholder.Title> Find friends - </Placeholder.Header> + </Placeholder.Title> - <Placeholder.Text> + <Placeholder.Description> The people you add as your friends will be displayed here - </Placeholder.Text> + </Placeholder.Description> </Placeholder.Container> ```
- Loading branch information
1 parent
596d928
commit 96fcb5a
Showing
31 changed files
with
207 additions
and
74 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
packages/codemods/src/transforms/v7/__testfixtures__/placeholder/basic.input.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,38 @@ | ||
import { Button,ButtonGroup, Icon56UserAddOutline, Icon56UsersOutline, Placeholder } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
{/* Проверяем переименование свойства header */} | ||
<Placeholder | ||
icon={<Icon56UsersOutline />} | ||
header={<Button size="m">Подключить сообщества</Button>} | ||
> | ||
Подключите сообщества, от которых Вы хотите получать уведомления | ||
</Placeholder> | ||
|
||
{/* Проверяем переименование подкомпонента Header */} | ||
<Placeholder.Container> | ||
<Placeholder.Header>Find friends</Placeholder.Header> | ||
</Placeholder.Container> | ||
|
||
{/* Проверяем переименование подкомпонента Header и Text */} | ||
<Placeholder.Container> | ||
<Placeholder.Icon> | ||
<Icon56UserAddOutline /> | ||
</Placeholder.Icon> | ||
<Placeholder.Header>Find friends</Placeholder.Header> | ||
<Placeholder.Text>The people you add as your friends will be displayed here</Placeholder.Text> | ||
<Placeholder.Actions> | ||
<ButtonGroup mode="vertical" align="center"> | ||
<Button size="m">Button</Button> | ||
<Button size="m" mode="tertiary"> | ||
Button | ||
</Button> | ||
</ButtonGroup> | ||
</Placeholder.Actions> | ||
</Placeholder.Container> | ||
</React.Fragment> | ||
); | ||
}; |
40 changes: 40 additions & 0 deletions
40
packages/codemods/src/transforms/v7/__tests__/__snapshots__/placeholder.ts.snap
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,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`placeholder transforms correctly 1`] = ` | ||
"import { Button,ButtonGroup, Icon56UserAddOutline, Icon56UsersOutline, Placeholder } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
{/* Проверяем переименование свойства header */} | ||
<Placeholder | ||
icon={<Icon56UsersOutline />} | ||
title={<Button size="m">Подключить сообщества</Button>} | ||
> | ||
Подключите сообщества, от которых Вы хотите получать уведомления | ||
</Placeholder> | ||
{/* Проверяем переименование подкомпонента Header */} | ||
<Placeholder.Container> | ||
<Placeholder.Title>Find friends</Placeholder.Title> | ||
</Placeholder.Container> | ||
{/* Проверяем переименование подкомпонента Header и Text */} | ||
<Placeholder.Container> | ||
<Placeholder.Icon> | ||
<Icon56UserAddOutline /> | ||
</Placeholder.Icon> | ||
<Placeholder.Title>Find friends</Placeholder.Title> | ||
<Placeholder.Description>The people you add as your friends will be displayed here</Placeholder.Description> | ||
<Placeholder.Actions> | ||
<ButtonGroup mode="vertical" align="center"> | ||
<Button size="m">Button</Button> | ||
<Button size="m" mode="tertiary"> | ||
Button | ||
</Button> | ||
</ButtonGroup> | ||
</Placeholder.Actions> | ||
</Placeholder.Container> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/placeholder.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,12 @@ | ||
jest.autoMockOff(); | ||
|
||
import { defineSnapshotTestFromFixture } from '../../../testHelpers/testHelper'; | ||
|
||
const name = 'placeholder'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
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,23 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp, renameSubComponent } from '../../codemod-helpers'; | ||
import { JSCodeShiftOptions } from '../../types'; | ||
|
||
export const parser = 'tsx'; | ||
|
||
export default function transformer(file: FileInfo, api: API, options: JSCodeShiftOptions) { | ||
const { alias } = options; | ||
const j = api.jscodeshift; | ||
const source = j(file.source); | ||
const { localName } = getImportInfo(j, file, 'Placeholder', alias); | ||
|
||
if (!localName) { | ||
return source.toSource(); | ||
} | ||
|
||
renameProp(j, source, localName, { header: 'title' }); | ||
|
||
renameSubComponent(j, source, localName, 'Header', 'Title'); | ||
renameSubComponent(j, source, localName, 'Text', 'Description'); | ||
|
||
return source.toSource(); | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.