From 5ec37a3a75ac2fdccf654aa0679d32ebc6e149d0 Mon Sep 17 00:00:00 2001 From: "e.muhamethanov" Date: Mon, 28 Oct 2024 15:07:26 +0300 Subject: [PATCH 1/2] feat(SimpleCell): rename subhead to overTitle --- .../v7/__testfixtures__/cell-button/basic.input.tsx | 5 +++++ .../v7/__testfixtures__/cell/basic.input.tsx | 9 +++++++++ .../v7/__testfixtures__/simple-cell/basic.input.tsx | 10 ++++++++++ .../v7/__tests__/__snapshots__/cell-button.ts.snap | 4 ++++ .../transforms/v7/__tests__/__snapshots__/cell.ts.snap | 8 ++++++++ .../v7/__tests__/__snapshots__/simple-cell.ts.snap | 8 ++++++++ packages/codemods/src/transforms/v7/cell-button.ts | 4 +++- packages/codemods/src/transforms/v7/cell.ts | 1 + packages/codemods/src/transforms/v7/simple-cell.ts | 1 + .../src/components/CellButton/CellButton.stories.tsx | 2 +- .../SimpleCell/SimpleCell.e2e-playground.tsx | 2 +- .../src/components/SimpleCell/SimpleCell.module.css | 2 +- .../src/components/SimpleCell/SimpleCell.stories.tsx | 2 +- packages/vkui/src/components/SimpleCell/SimpleCell.tsx | 10 +++++----- 14 files changed, 58 insertions(+), 10 deletions(-) diff --git a/packages/codemods/src/transforms/v7/__testfixtures__/cell-button/basic.input.tsx b/packages/codemods/src/transforms/v7/__testfixtures__/cell-button/basic.input.tsx index 8dbee448ab..a0d09b8b85 100644 --- a/packages/codemods/src/transforms/v7/__testfixtures__/cell-button/basic.input.tsx +++ b/packages/codemods/src/transforms/v7/__testfixtures__/cell-button/basic.input.tsx @@ -33,6 +33,11 @@ const App = () => { Создать что-нибудь + + {/* rename subhead -> overtitle */} + + Создать что-нибудь + ); }; diff --git a/packages/codemods/src/transforms/v7/__testfixtures__/cell/basic.input.tsx b/packages/codemods/src/transforms/v7/__testfixtures__/cell/basic.input.tsx index 64276f4223..5f3a2c1b7c 100644 --- a/packages/codemods/src/transforms/v7/__testfixtures__/cell/basic.input.tsx +++ b/packages/codemods/src/transforms/v7/__testfixtures__/cell/basic.input.tsx @@ -19,6 +19,15 @@ const App = () => { > Геолокация + + {/* rename subhead -> overtitle */} + {}} + indicator="При использовании" + > + Геолокация + ); }; diff --git a/packages/codemods/src/transforms/v7/__testfixtures__/simple-cell/basic.input.tsx b/packages/codemods/src/transforms/v7/__testfixtures__/simple-cell/basic.input.tsx index 7eb68fe467..c98a6cc8ba 100644 --- a/packages/codemods/src/transforms/v7/__testfixtures__/simple-cell/basic.input.tsx +++ b/packages/codemods/src/transforms/v7/__testfixtures__/simple-cell/basic.input.tsx @@ -19,6 +19,16 @@ const App = () => { > Геолокация + + + {/* rename subhead -> overtitle */} + {}} + subhead={"Subhead"} + indicator="При использовании" + > + Геолокация + ); }; diff --git a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell-button.ts.snap b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell-button.ts.snap index aae725ef24..0ba2f0ef80 100644 --- a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell-button.ts.snap +++ b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell-button.ts.snap @@ -31,6 +31,10 @@ const App = () => { Создать что-нибудь + {/* rename subhead -> overtitle */} + + Создать что-нибудь + ) ); };" diff --git a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell.ts.snap b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell.ts.snap index 7753d6e8c6..46c0a1f072 100644 --- a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell.ts.snap +++ b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/cell.ts.snap @@ -21,6 +21,14 @@ const App = () => { > Геолокация + {/* rename subhead -> overtitle */} + {}} + indicator="При использовании" + > + Геолокация + ) ); };" diff --git a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/simple-cell.ts.snap b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/simple-cell.ts.snap index 451a6a1d0a..d1253bd820 100644 --- a/packages/codemods/src/transforms/v7/__tests__/__snapshots__/simple-cell.ts.snap +++ b/packages/codemods/src/transforms/v7/__tests__/__snapshots__/simple-cell.ts.snap @@ -21,6 +21,14 @@ const App = () => { > Геолокация + {/* rename subhead -> overtitle */} + {}} + overTitle={"Subhead"} + indicator="При использовании" + > + Геолокация + ) ); };" diff --git a/packages/codemods/src/transforms/v7/cell-button.ts b/packages/codemods/src/transforms/v7/cell-button.ts index e760c36ad2..e0eb60299d 100644 --- a/packages/codemods/src/transforms/v7/cell-button.ts +++ b/packages/codemods/src/transforms/v7/cell-button.ts @@ -1,5 +1,5 @@ import { API, FileInfo, JSXAttribute } from 'jscodeshift'; -import { getImportInfo } from '../../codemod-helpers'; +import { getImportInfo, renameProp } from '../../codemod-helpers'; import { report } from '../../report'; import { JSCodeShiftOptions } from '../../types'; @@ -14,6 +14,8 @@ export default function transformer(file: FileInfo, api: API, options: JSCodeShi return source.toSource(); } + renameProp(j, source, localName, { subhead: 'overTitle' }); + const attributeToReplace = 'mode'; const newAttributeName = 'appearance'; diff --git a/packages/codemods/src/transforms/v7/cell.ts b/packages/codemods/src/transforms/v7/cell.ts index 979d496f14..0816bfa3ef 100644 --- a/packages/codemods/src/transforms/v7/cell.ts +++ b/packages/codemods/src/transforms/v7/cell.ts @@ -12,6 +12,7 @@ export default function transformer(file: FileInfo, api: API, options: JSCodeShi if (localName) { renameProp(j, source, localName, { + subhead: 'overTitle', expandable: 'chevron', }); } diff --git a/packages/codemods/src/transforms/v7/simple-cell.ts b/packages/codemods/src/transforms/v7/simple-cell.ts index 1c356a97ec..809a00679b 100644 --- a/packages/codemods/src/transforms/v7/simple-cell.ts +++ b/packages/codemods/src/transforms/v7/simple-cell.ts @@ -13,6 +13,7 @@ export default function transformer(file: FileInfo, api: API, options: JSCodeShi if (localName) { renameProp(j, source, localName, { expandable: 'chevron', + subhead: 'overTitle', }); } diff --git a/packages/vkui/src/components/CellButton/CellButton.stories.tsx b/packages/vkui/src/components/CellButton/CellButton.stories.tsx index 49e4ccb6f2..80d5a7e95e 100644 --- a/packages/vkui/src/components/CellButton/CellButton.stories.tsx +++ b/packages/vkui/src/components/CellButton/CellButton.stories.tsx @@ -45,7 +45,7 @@ const story: Meta = { }), subtitle: StringArg, extraSubtitle: StringArg, - subhead: StringArg, + overTitle: StringArg, }, }; diff --git a/packages/vkui/src/components/SimpleCell/SimpleCell.e2e-playground.tsx b/packages/vkui/src/components/SimpleCell/SimpleCell.e2e-playground.tsx index 88bdc0831d..2a4f5d6368 100644 --- a/packages/vkui/src/components/SimpleCell/SimpleCell.e2e-playground.tsx +++ b/packages/vkui/src/components/SimpleCell/SimpleCell.e2e-playground.tsx @@ -67,7 +67,7 @@ export const SimpleCellPlayground = (props: ComponentPlaygroundProps) => { }, { before: [], - subhead: ['Subhead'], + overTitle: ['Subhead'], children: ['Title'], subtitle: ['Subtitle'], extraSubtitle: ['Extra Subtitle'], diff --git a/packages/vkui/src/components/SimpleCell/SimpleCell.module.css b/packages/vkui/src/components/SimpleCell/SimpleCell.module.css index a3586a5522..3c59121c69 100644 --- a/packages/vkui/src/components/SimpleCell/SimpleCell.module.css +++ b/packages/vkui/src/components/SimpleCell/SimpleCell.module.css @@ -60,7 +60,7 @@ margin-block-start: var(--vkui--spacing_size_2xs); } -.subhead { +.overTitle { color: var(--vkui--color_text_subhead); } diff --git a/packages/vkui/src/components/SimpleCell/SimpleCell.stories.tsx b/packages/vkui/src/components/SimpleCell/SimpleCell.stories.tsx index 84afee9bdc..9bfc8e4c83 100644 --- a/packages/vkui/src/components/SimpleCell/SimpleCell.stories.tsx +++ b/packages/vkui/src/components/SimpleCell/SimpleCell.stories.tsx @@ -16,7 +16,7 @@ const story: Meta = { component: SimpleCell, parameters: { ...CanvasFullLayout, ...DisableCartesianParam }, argTypes: { - subhead: StringArg, + overTitle: StringArg, extraSubtitle: StringArg, before: createFieldWithPresets({ iconSizes: ['28'], diff --git a/packages/vkui/src/components/SimpleCell/SimpleCell.tsx b/packages/vkui/src/components/SimpleCell/SimpleCell.tsx index 7b40114c29..83c18194ba 100644 --- a/packages/vkui/src/components/SimpleCell/SimpleCell.tsx +++ b/packages/vkui/src/components/SimpleCell/SimpleCell.tsx @@ -45,7 +45,7 @@ export interface SimpleCellOwnProps extends HasComponent { /** * Дополнительная строка текста над `children`. */ - subhead?: React.ReactNode; + overTitle?: React.ReactNode; /** * Дополнительная строка текста под `children`. */ @@ -95,7 +95,7 @@ export const SimpleCell = ({ after, chevron, multiline, - subhead, + overTitle, subtitle, extraSubtitle, className, @@ -124,9 +124,9 @@ export const SimpleCell = ({ {before}
- {subhead && ( - - {subhead} + {overTitle && ( + + {overTitle} )}
From a4b90d13a1f20cca443be77d67f5713f0e886d60 Mon Sep 17 00:00:00 2001 From: "e.muhamethanov" Date: Mon, 28 Oct 2024 17:14:52 +0300 Subject: [PATCH 2/2] test(SimpleCell): update screenshots --- .../simplecell-android-chromium-dark-1-snap.png | 4 ++-- .../simplecell-android-chromium-light-1-snap.png | 4 ++-- .../__image_snapshots__/simplecell-ios-webkit-dark-1-snap.png | 4 ++-- .../simplecell-ios-webkit-light-1-snap.png | 4 ++-- .../simplecell-vkcom-chromium-dark-1-snap.png | 4 ++-- .../simplecell-vkcom-chromium-light-1-snap.png | 4 ++-- .../simplecell-vkcom-firefox-dark-1-snap.png | 4 ++-- .../simplecell-vkcom-firefox-light-1-snap.png | 4 ++-- .../simplecell-vkcom-webkit-dark-1-snap.png | 4 ++-- .../simplecell-vkcom-webkit-light-1-snap.png | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-dark-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-dark-1-snap.png index cadfe562f0..fd1d1bc1a4 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-dark-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff1fb5d3986e6628fea13b1e2e9c08485bd63f4bb284177b62acea341b81a84 -size 133088 +oid sha256:f67c7f5f5bc0bacebdf30bd841e02c55474db7612fb5664763a4541c08d0fc5e +size 133391 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-light-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-light-1-snap.png index b28db9cb02..a9fcd6622e 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-light-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-android-chromium-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49b8b6a3826583068c7d3e2c879073443cf7f9c6e9ff4b8c2de4ab7bf19d8ed6 -size 129271 +oid sha256:373ef913ee31cbfa682dc6b6ace8d8e2dc0718b637cd4bf3bf01307e9f788e2e +size 129652 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-dark-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-dark-1-snap.png index 9ad8dfdc79..126d47269f 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-dark-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1bc127074fbccd75fd0fd1a2e18849f8a6a89f6c19e2d4ac8cb60da4ad6ebc1 -size 138304 +oid sha256:6a52d02b4d3aefddd4548fb9c4449fe9d2a113ff3b27c65f89549de274ee304b +size 138770 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-light-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-light-1-snap.png index 98c236d89e..a1173a101b 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-light-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-ios-webkit-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7af6f83a7ef40c42eb372995c8c134b6e7762c07f59b865dc57d9cae8b2d93ab -size 133792 +oid sha256:c2c921db0396b5e0803dc19150bc65a77368543eb0447ca66e974e8a67da8652 +size 134284 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-dark-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-dark-1-snap.png index 4ee6004a85..e11fb6f07b 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-dark-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:225698f6f62f429db0a5e899384c864ada8d1870388fa2fa78e32b29a8a7a3c0 -size 118627 +oid sha256:2684cd6f6be7e1fe1e4d6184369b218a2f50b61de789e026758058944aaeffac +size 118897 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-light-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-light-1-snap.png index 6eca907a8b..d223ea8db2 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-light-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-chromium-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:faa1bce2967558b1948d18f249dde88394a47686b3a94f59778eac2748eea042 -size 120402 +oid sha256:f9dd3b5e6f24f26f25030336c6bee8890ca32fd2397709ca7d61b1b2093abc9a +size 120819 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-dark-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-dark-1-snap.png index 1bb2b96e8c..cd5d65f4ba 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-dark-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e883aa88db1b06fbcf339292557c497065d1e065561dda62e22a73d92d34d548 -size 212266 +oid sha256:585f032b0e56699b0b41c79ffb06d3c013b4feb90794eebf80058fa05bfecb91 +size 212068 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-light-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-light-1-snap.png index 19413dc7ab..85df884a6d 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-light-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-firefox-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0331465297206fbf63bb319618546dfe5d509d88f17a680a2e9a9649c856d878 -size 210920 +oid sha256:6e3407c2892dc7ef168f8afefe2a6011f5442f4f86ef7a290504dc7f521470ba +size 210735 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-dark-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-dark-1-snap.png index 6e9d448fe0..93261fd1f4 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-dark-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0f9c48bdb2ebec4b77a6a757230be0d784e2d38f3b395f9d5de543f19e262ba -size 122912 +oid sha256:00dbbb7873f6d8ac1547c3261808a8c92b03f647244f28ea23919d268cd88733 +size 123225 diff --git a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-light-1-snap.png b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-light-1-snap.png index d1adbd67f3..e3296d69d2 100644 --- a/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-light-1-snap.png +++ b/packages/vkui/src/components/SimpleCell/__image_snapshots__/simplecell-vkcom-webkit-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c30aa48402a209633ea11547d329b61f6b5174b38f3c707ec643dd5876aaab58 -size 123685 +oid sha256:391d406dfea789cc713623cacd897cf9285a2b8bb73a80efef768526db382913 +size 123993