Skip to content

Commit

Permalink
refactor(Separator): rename wide to noPadding (#7718)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackySoul authored Oct 7, 2024
1 parent 6d9899e commit 28ba7a7
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const App = () => {
<Separator mode="primary" />
<Separator mode="primary-alpha" wide />
<Separator mode={"secondary"} />
<Separator wide={false} />
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const App = () => {
return (
(<React.Fragment>
<Separator appearance="primary" />
<Separator appearance="primary-alpha" wide />
<Separator appearance="primary-alpha" noPadding />
<Separator appearance={"secondary"} />
<Separator noPadding={false} />
</React.Fragment>)
);
};"
Expand Down
1 change: 1 addition & 0 deletions packages/codemods/src/transforms/v7/separator.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, { mode: 'appearance' });
renameProp(j, source, localName, { wide: 'noPadding' });
}

return source.toSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const FixedLayoutPlayground = (
<Panel id="fixedLayout">
<PanelHeader>Fixed layout</PanelHeader>
<FixedLayout filled={filled} vertical={vertical}>
<Separator wide />
<Separator noPadding />
<Tabs>
<TabsItem selected>176 сообществ</TabsItem>
<TabsItem>9 событий</TabsItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const Playground: Story = {
<Panel id="fixedLayout">
<PanelHeader>Fixed layout</PanelHeader>
<FixedLayout {...args}>
<Separator wide />
<Separator noPadding />
<Tabs>
<TabsItem selected>176 сообществ</TabsItem>
<TabsItem>9 событий</TabsItem>
Expand All @@ -55,7 +55,7 @@ export const WithSearchAndContent: Story = {
<PanelHeader>Fixed layout</PanelHeader>
<FixedLayout {...args}>
<Search />
<Separator wide />
<Separator noPadding />
</FixedLayout>
<StubContent />
</Panel>
Expand Down
4 changes: 2 additions & 2 deletions packages/vkui/src/components/FixedLayout/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Example = () => {
<PanelHeader fixed>Fixed layout</PanelHeader>
<FixedLayout vertical="top" filled>
<Search />
<Separator wide />
<Separator noPadding />
</FixedLayout>
<Group>
<Div style={contentStyles}>
Expand Down Expand Up @@ -75,7 +75,7 @@ const Example = () => {
</Div>
</Group>
<FixedLayout filled vertical="bottom">
<Separator wide />
<Separator noPadding />
<Tabs>
<TabsItem selected={activeTab === 'groups'} onClick={() => setActiveTab('groups')}>
176 сообществ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const ModalPageHeader = ({
{children}
</PanelHeader>
</div>
{!noSeparator && <Separator wide={sizeX === 'regular'} />}
{!noSeparator && <Separator noPadding={sizeX === 'regular'} />}
</>
);
};
2 changes: 1 addition & 1 deletion packages/vkui/src/components/PanelHeader/PanelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const PanelHeader = ({
)}
</>
)}
{separatorVisible && isVKCOM && <Separator className={styles.separator} wide />}
{separatorVisible && isVKCOM && <Separator className={styles.separator} noPadding />}
</RootComponent>
);
};
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Separator/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Используется для разделения какого-либо контента. Отступы справа и слева контролируются свойством `wide`.
Используется для разделения какого-либо контента. Отступы справа и слева контролируются свойством `noPadding`.

```jsx
<View activePanel="separator">
Expand Down
6 changes: 3 additions & 3 deletions packages/vkui/src/components/Separator/Separator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface SeparatorProps extends HTMLAttributesWithRootRef<HTMLDivElement
/**
* С этим свойством компонент не будет иметь отступы слева и справа
*/
wide?: boolean;
noPadding?: boolean;
}

const appearanceClassNames = {
Expand All @@ -24,13 +24,13 @@ const appearanceClassNames = {
* @see https://vkcom.github.io/VKUI/#/Separator
*/
export const Separator = ({
wide,
noPadding,
appearance = 'primary',
...restProps
}: SeparatorProps): React.ReactNode => (
<RootComponent
{...restProps}
baseClassName={classNames(!wide && styles.padded, appearanceClassNames[appearance])}
baseClassName={classNames(!noPadding && styles.padded, appearanceClassNames[appearance])}
>
<hr className={styles.in} />
</RootComponent>
Expand Down
4 changes: 2 additions & 2 deletions packages/vkui/src/components/WriteBar/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ const WriteBarExample = (props) => {

<FixedLayout vertical="bottom" filled>
<div ref={fixedLayoutInnerElRef}>
<Separator wide />
<Separator noPadding />

{isAttachmentsShown && (
<div>
<Div>Интерфейс прикрепления</Div>
<Separator wide />
<Separator noPadding />
</div>
)}

Expand Down

0 comments on commit 28ba7a7

Please sign in to comment.