-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Spacing): remove 3xs size type (#7634)
h2. Описание Сейчас в некоторых местах в css используется токен `--vkui--spacing_size_3xs`, но этот токен устарел и равен токену `--vkui--spacing_size_2xs`. Нужно избавиться от использования этого токена в css h2. Изменения - Выпилил использование этого токена в компоненте Spacing, соответственно удалил один из вариантов пропа size - Реализовал кодмод, чтобы size: 3xs преобразовывался в 2xs в Spacing. - Заменил использование токена `--vkui--spacing_size_3xs` на `--vkui--spacing_size_2xs` в css компонента Header h2. Release notes h2. BREAKING CHANGE - Spacing: удален вариант значения пропа size `3xs` вместо него можно использовать `2xs`, он такой же по значению ```diff - <Spacing size="3xs" /> + <Spacing size="2xs" /> ```
- Loading branch information
1 parent
e98a9e4
commit 491772f
Showing
13 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/codemods/src/transforms/v7/__testfixtures__/spacing/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 { Separator, Spacing } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<Spacing size="3xs"> | ||
<Separator/> | ||
</Spacing> | ||
|
||
<Spacing size="3xs" /> | ||
|
||
<Spacing size={"3xs"} /> | ||
</React.Fragment> | ||
); | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/codemods/src/transforms/v7/__tests__/__snapshots__/spacing.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,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`spacing transforms correctly 1`] = ` | ||
"import { Separator, Spacing } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<Spacing size="2xs"> | ||
<Separator/> | ||
</Spacing> | ||
<Spacing size="2xs" /> | ||
<Spacing size={"2xs"} /> | ||
</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,11 @@ | ||
jest.autoMockOff(); | ||
import { defineSnapshotTestFromFixture } from '../../../testHelpers/testHelper'; | ||
|
||
const name = 'spacing'; | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { remapSizePropValue } from './common/remapSizePropValue'; | ||
import { getImportInfo } 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, 'Spacing', alias); | ||
|
||
if (!localName) { | ||
return source.toSource(); | ||
} | ||
|
||
remapSizePropValue({ | ||
j, | ||
api, | ||
source, | ||
componentName: localName, | ||
sizesMap: { | ||
'3xs': '2xs', | ||
}, | ||
}); | ||
|
||
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
4 changes: 2 additions & 2 deletions
4
.../components/Spacing/__image_snapshots__/spacing-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
...c/components/Spacing/__image_snapshots__/spacing-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
...rc/components/Spacing/__image_snapshots__/spacing-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.