-
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(ActionSheet): rename
header
to title
, text
to description
(
- Loading branch information
1 parent
e5c337d
commit 9af33b2
Showing
20 changed files
with
104 additions
and
38 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/codemods/src/transforms/v7/__testfixtures__/action-sheet/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 { ActionSheet, ActionSheetItem } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<ActionSheet | ||
onClose={() => {}} | ||
header="Вы действительно хотите удалить это видео из Ваших видео?" | ||
text="Данное действие реально удалит видео, подумайте!" | ||
> | ||
<ActionSheetItem mode="destructive">Удалить видео</ActionSheetItem> | ||
</ActionSheet> | ||
</React.Fragment> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
packages/codemods/src/transforms/v7/__tests__/__snapshots__/action-sheet.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[`action-sheet transforms correctly 1`] = ` | ||
"import { ActionSheet, ActionSheetItem } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<ActionSheet | ||
onClose={() => {}} | ||
title="Вы действительно хотите удалить это видео из Ваших видео?" | ||
description="Данное действие реально удалит видео, подумайте!" | ||
> | ||
<ActionSheetItem mode="destructive">Удалить видео</ActionSheetItem> | ||
</ActionSheet> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/action-sheet.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 = 'action-sheet'; | ||
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,18 @@ | ||
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, 'ActionSheet', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { header: 'title', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ const propSets = [ | |
</ActionSheetItem>, | ||
], | ||
], | ||
header: ['Заголовок'], | ||
title: ['Заголовок'], | ||
}, | ||
]; | ||
|
||
|
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
4 changes: 2 additions & 2 deletions
4
...ts__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-chromium-dark-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...s__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-chromium-light-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ots__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-firefox-dark-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ts__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-firefox-light-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...hots__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-webkit-dark-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ots__/actionsheet-viewwidth-desktop-sizey-regular-vkcom-webkit-light-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...s__/actionsheet-viewwidth-mobile-sizey-regular-android-chromium-dark-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...__/actionsheet-viewwidth-mobile-sizey-regular-android-chromium-light-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...apshots__/actionsheet-viewwidth-mobile-sizey-regular-ios-webkit-dark-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...pshots__/actionsheet-viewwidth-mobile-sizey-regular-ios-webkit-light-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.