Skip to content

Commit acef79e

Browse files
authored
refactor: use css logical properties (#919)
* use css Logical properties * fix test case
1 parent 1169726 commit acef79e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

docs/examples/extra.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default () => {
117117
/>
118118
<label htmlFor="default-position">default position(right)</label>
119119
</div>
120-
<div style={{ marginLeft: '15px' }}>
120+
<div style={{ marginInlineStart: '15px' }}>
121121
<input
122122
id="coustom-position"
123123
ref={checkRef}

src/TabNavList/OperationNode.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
177177

178178
// ========================= Render =========================
179179
const moreStyle: React.CSSProperties = {
180-
[rtl ? 'marginRight' : 'marginLeft']: tabBarGutter,
180+
marginInlineStart: tabBarGutter,
181181
};
182+
182183
if (!tabs.length) {
183184
moreStyle.visibility = 'hidden';
184185
moreStyle.order = 1;

src/TabNavList/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,9 @@ const TabNavList = React.forwardRef<HTMLDivElement, TabNavListProps>((props, ref
421421

422422
// ========================== Tab ==========================
423423
const tabNodeStyle: React.CSSProperties = {};
424+
424425
if (tabPositionTopOrBottom) {
425-
tabNodeStyle[rtl ? 'marginRight' : 'marginLeft'] = tabBarGutter;
426+
tabNodeStyle.marginInlineStart = tabBarGutter;
426427
} else {
427428
tabNodeStyle.marginTop = tabBarGutter;
428429
}

tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ describe('Tabs.Basic', () => {
281281
it('tabBarGutter should work', () => {
282282
const topTabs = render(getTabs({ tabBarGutter: 23 }));
283283
expect(topTabs.container.querySelectorAll('.rc-tabs-tab')[0]).toHaveStyle({
284-
marginLeft: undefined,
284+
marginInlineStart: undefined,
285285
});
286286
expect(topTabs.container.querySelectorAll('.rc-tabs-tab')[1]).toHaveStyle({
287-
marginLeft: '23px',
287+
marginInlineStart: '23px',
288288
});
289289

290290
const rightTabs = render(getTabs({ tabBarGutter: 33, tabPosition: 'right' }));

0 commit comments

Comments
 (0)