Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SimpleCell): rename subhead to overTitle #7861

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const App = () => {
<CellButton centered>
Создать что-нибудь
</CellButton>

{/* rename subhead -> overtitle */}
<CellButton centered subhead={"Subhead"}>
Создать что-нибудь
</CellButton>
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ const App = () => {
>
Геолокация
</Cell>

{/* rename subhead -> overtitle */}
<Cell
subhead={"Subhead"}
onClick={() => {}}
indicator="При использовании"
>
Геолокация
</Cell>
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ const App = () => {
>
Геолокация
</SimpleCell>


{/* rename subhead -> overtitle */}
<SimpleCell
onClick={() => {}}
subhead={"Subhead"}
indicator="При использовании"
>
Геолокация
</SimpleCell>
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const App = () => {
<CellButton centered>
Создать что-нибудь
</CellButton>
{/* rename subhead -> overtitle */}
<CellButton centered overTitle={"Subhead"}>
Создать что-нибудь
</CellButton>
</React.Fragment>)
);
};"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const App = () => {
>
Геолокация
</Cell>
{/* rename subhead -> overtitle */}
<Cell
overTitle={"Subhead"}
onClick={() => {}}
indicator="При использовании"
>
Геолокация
</Cell>
</React.Fragment>)
);
};"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const App = () => {
>
Геолокация
</SimpleCell>
{/* rename subhead -> overtitle */}
<SimpleCell
onClick={() => {}}
overTitle={"Subhead"}
indicator="При использовании"
>
Геолокация
</SimpleCell>
</React.Fragment>)
);
};"
Expand Down
4 changes: 3 additions & 1 deletion packages/codemods/src/transforms/v7/cell-button.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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';

Expand Down
1 change: 1 addition & 0 deletions packages/codemods/src/transforms/v7/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function transformer(file: FileInfo, api: API, options: JSCodeShi

if (localName) {
renameProp(j, source, localName, {
subhead: 'overTitle',
expandable: 'chevron',
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/codemods/src/transforms/v7/simple-cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function transformer(file: FileInfo, api: API, options: JSCodeShi
if (localName) {
renameProp(j, source, localName, {
expandable: 'chevron',
subhead: 'overTitle',
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const story: Meta<CellButtonProps> = {
}),
subtitle: StringArg,
extraSubtitle: StringArg,
subhead: StringArg,
overTitle: StringArg,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const SimpleCellPlayground = (props: ComponentPlaygroundProps) => {
},
{
before: [<Avatar key="avatar" size={40} />],
subhead: ['Subhead'],
overTitle: ['Subhead'],
children: ['Title'],
subtitle: ['Subtitle'],
extraSubtitle: ['Extra Subtitle'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
margin-block-start: var(--vkui--spacing_size_2xs);
}

.subhead {
.overTitle {
color: var(--vkui--color_text_subhead);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const story: Meta<SimpleCellProps> = {
component: SimpleCell,
parameters: { ...CanvasFullLayout, ...DisableCartesianParam },
argTypes: {
subhead: StringArg,
overTitle: StringArg,
extraSubtitle: StringArg,
before: createFieldWithPresets({
iconSizes: ['28'],
Expand Down
10 changes: 5 additions & 5 deletions packages/vkui/src/components/SimpleCell/SimpleCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface SimpleCellOwnProps extends HasComponent {
/**
* Дополнительная строка текста над `children`.
*/
subhead?: React.ReactNode;
overTitle?: React.ReactNode;
/**
* Дополнительная строка текста под `children`.
*/
Expand Down Expand Up @@ -95,7 +95,7 @@ export const SimpleCell = ({
after,
chevron,
multiline,
subhead,
overTitle,
subtitle,
extraSubtitle,
className,
Expand Down Expand Up @@ -124,9 +124,9 @@ export const SimpleCell = ({
{before}
</div>
<div className={styles.middle}>
{subhead && (
<Subhead Component="span" className={classNames(styles.text, styles.subhead)}>
{subhead}
{overTitle && (
<Subhead Component="span" className={classNames(styles.text, styles.overTitle)}>
{overTitle}
</Subhead>
)}
<div className={styles.content}>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading