-
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(SimpleCell, MiniInfoCell, SubnavigationButton): rename expandabl…
…e prop to chevron (#7787) * feat(SimpleCell,MiniInfoCell): rename expandable to chevron * feat(SubnavigationButton): rename expandable to chevron
- Loading branch information
1 parent
98faaac
commit 5fc002c
Showing
63 changed files
with
426 additions
and
105 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/codemods/src/transforms/v7/__testfixtures__/cell/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,24 @@ | ||
import { Cell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<Cell | ||
onClick={() => {}} | ||
expandable="auto" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</Cell> | ||
|
||
<Cell | ||
onClick={() => {}} | ||
expandable="always" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</Cell> | ||
</React.Fragment> | ||
); | ||
}; |
28 changes: 28 additions & 0 deletions
28
packages/codemods/src/transforms/v7/__testfixtures__/mini-info-cell/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,28 @@ | ||
import { Icon20WorkOutline, MiniInfoCell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<MiniInfoCell | ||
before={<Icon20WorkOutline />} | ||
mode="add" | ||
onClick={() => console.log('Указать место учёбы')} | ||
textWrap="short" | ||
expandable | ||
> | ||
Укажите место учёбы | ||
</MiniInfoCell> | ||
|
||
<MiniInfoCell | ||
before={<Icon20WorkOutline />} | ||
mode="add" | ||
onClick={() => console.log('Указать место учёбы')} | ||
textWrap="short" | ||
expandable={false} | ||
> | ||
Укажите место учёбы | ||
</MiniInfoCell> | ||
</React.Fragment> | ||
); | ||
}; |
24 changes: 24 additions & 0 deletions
24
packages/codemods/src/transforms/v7/__testfixtures__/simple-cell/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,24 @@ | ||
import { SimpleCell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<SimpleCell | ||
onClick={() => {}} | ||
expandable="auto" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</SimpleCell> | ||
|
||
<SimpleCell | ||
onClick={() => {}} | ||
expandable="always" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</SimpleCell> | ||
</React.Fragment> | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
packages/codemods/src/transforms/v7/__testfixtures__/subnavigation-button/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,16 @@ | ||
import { SubnavigationButton } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<SubnavigationButton | ||
expandable={true} | ||
selected={true} | ||
onClick={() => {}} | ||
> | ||
Button | ||
</SubnavigationButton> | ||
</React.Fragment> | ||
); | ||
}; |
27 changes: 27 additions & 0 deletions
27
packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell.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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`cell transforms correctly 1`] = ` | ||
"import { Cell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<Cell | ||
onClick={() => {}} | ||
chevron="auto" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</Cell> | ||
<Cell | ||
onClick={() => {}} | ||
chevron="always" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</Cell> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
31 changes: 31 additions & 0 deletions
31
packages/codemods/src/transforms/v7/__tests__/__snapshots__/mini-info-cell.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,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`mini-info-cell transforms correctly 1`] = ` | ||
"import { Icon20WorkOutline, MiniInfoCell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<MiniInfoCell | ||
before={<Icon20WorkOutline />} | ||
mode="add" | ||
onClick={() => console.log('Указать место учёбы')} | ||
textWrap="short" | ||
chevron | ||
> | ||
Укажите место учёбы | ||
</MiniInfoCell> | ||
<MiniInfoCell | ||
before={<Icon20WorkOutline />} | ||
mode="add" | ||
onClick={() => console.log('Указать место учёбы')} | ||
textWrap="short" | ||
chevron={false} | ||
> | ||
Укажите место учёбы | ||
</MiniInfoCell> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
27 changes: 27 additions & 0 deletions
27
packages/codemods/src/transforms/v7/__tests__/__snapshots__/simple-cell.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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`simple-cell transforms correctly 1`] = ` | ||
"import { SimpleCell } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<SimpleCell | ||
onClick={() => {}} | ||
chevron="auto" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</SimpleCell> | ||
<SimpleCell | ||
onClick={() => {}} | ||
chevron="always" | ||
indicator="При использовании" | ||
> | ||
Геолокация | ||
</SimpleCell> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
20 changes: 20 additions & 0 deletions
20
packages/codemods/src/transforms/v7/__tests__/__snapshots__/subnavigation-button.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,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`subnavigation-button transforms correctly 1`] = ` | ||
"import { SubnavigationButton } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<SubnavigationButton | ||
chevron={true} | ||
selected={true} | ||
onClick={() => {}} | ||
> | ||
Button | ||
</SubnavigationButton> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
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 = 'cell'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/mini-info-cell.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 = 'mini-info-cell'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/simple-cell.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 = 'simple-cell'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/subnavigation-button.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 = 'subnavigation-button'; | ||
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,20 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp } 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, 'Cell', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { | ||
expandable: 'chevron', | ||
}); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp } 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, 'MiniInfoCell', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { | ||
expandable: 'chevron', | ||
}); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp } 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, 'SimpleCell', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { | ||
expandable: 'chevron', | ||
}); | ||
} | ||
|
||
return source.toSource(); | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/codemods/src/transforms/v7/subnavigation-button.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,20 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp } 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, 'SubnavigationButton', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { | ||
expandable: 'chevron', | ||
}); | ||
} | ||
|
||
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
Oops, something went wrong.