Skip to content

Commit 768de13

Browse files
authored
fix(react-drawer): rename values of position prop from left/right to start/end (#28905)
1 parent 039d87e commit 768de13

15 files changed

+30
-23
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: rename values of position prop from left/right to start/end",
4+
"packageName": "@fluentui/react-drawer",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-drawer/docs/Spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ By default, the `overlay` acts as a modal, rendering an overlay scrim behind the
7676
| Property | Values | Default | Description |
7777
| ------------ | ------------------------------------------ | --------- | ------------------------------------------------------- |
7878
| type | `overlay`, `inline` | `overlay` | Set the [type](#type) of Drawer |
79-
| position | `left`, `right` | `left` | Set the position of the Drawer |
79+
| position | `start`, `end` | `start` | Set the position of the Drawer |
8080
| size | `small`, `medium`, `large`, `full`, number | `small` | The drawer width [size](#size) |
8181
| modal | boolean | `true` | Set the visibility of the `overlay` scrim |
8282
| open | boolean | `false` | Define the Drawer visibility |

packages/react-components/react-drawer/src/components/Drawer/Drawer.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Drawer', () => {
3131

3232
return (
3333
<>
34-
<ControlledDrawer position="right" open={open} />
34+
<ControlledDrawer position="end" open={open} />
3535
<button id="button" onClick={() => setOpen(true)}>
3636
Open
3737
</button>

packages/react-components/react-drawer/src/components/DrawerInline/useDrawerInlineStyles.styles.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const useStyles = makeStyles({
1818
},
1919

2020
/* Separator */
21-
separatorLeft: {
21+
separatorStart: {
2222
...shorthands.borderRight('1px', 'solid', tokens.colorNeutralBackground3),
2323
},
24-
separatorRight: {
24+
separatorEnd: {
2525
...shorthands.borderLeft('1px', 'solid', tokens.colorNeutralBackground3),
2626
},
2727
});
@@ -38,8 +38,8 @@ export const useDrawerInlineStyles_unstable = (state: DrawerInlineState): Drawer
3838
return undefined;
3939
}
4040

41-
return state.position === 'left' ? styles.separatorLeft : styles.separatorRight;
42-
}, [state.position, state.separator, styles.separatorRight, styles.separatorLeft]);
41+
return state.position === 'start' ? styles.separatorStart : styles.separatorEnd;
42+
}, [state.position, state.separator, styles.separatorEnd, styles.separatorStart]);
4343

4444
state.root.className = mergeClasses(
4545
drawerInlineClassNames.root,

packages/react-components/react-drawer/src/util/DrawerBase.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ export type DrawerBaseProps = {
22
/**
33
* Position of the drawer.
44
*
5-
* @default 'left'
5+
* @default 'start'
66
*/
7-
position?: 'left' | 'right';
7+
position?: 'start' | 'end';
88

99
/**
1010
* Size of the drawer.

packages/react-components/react-drawer/src/util/getDefaultDrawerProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DrawerBaseProps } from './DrawerBase.types';
22

33
export function getDefaultDrawerProps(props: DrawerBaseProps) {
4-
const { open = false, defaultOpen = false, size = 'small', position = 'left' } = props;
4+
const { open = false, defaultOpen = false, size = 'small', position = 'start' } = props;
55

66
return {
77
size,

packages/react-components/react-drawer/src/util/useDrawerBaseStyles.styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export const useDrawerBaseStyles = makeStyles({
2222
},
2323

2424
/* Positioning */
25-
left: {
25+
start: {
2626
left: 0,
2727
right: 'auto',
2828
},
29-
right: {
29+
end: {
3030
right: 0,
3131
left: 'auto',
3232
},

packages/react-components/react-drawer/stories/Drawer/DrawerCustomSize.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const CustomSize = () => {
2828
<div>
2929
<DrawerOverlay
3030
open={open}
31-
position="right"
31+
position="end"
3232
onOpenChange={(_, state) => setOpen(state.open)}
3333
style={{ width: `${customSize}px` }}
3434
>

packages/react-components/react-drawer/stories/Drawer/DrawerInline.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const Inline = () => {
6161
</Button>
6262
</div>
6363

64-
<DrawerInline position="right" open={rightOpen}>
64+
<DrawerInline position="end" open={rightOpen}>
6565
<DrawerHeader>
6666
<DrawerHeaderTitle
6767
action={

packages/react-components/react-drawer/stories/Drawer/DrawerPosition.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ export const Position = () => {
1616
const styles = useStyles();
1717

1818
const [isOpen, setIsOpen] = React.useState(false);
19-
const [position, setPosition] = React.useState<DrawerProps['position']>('left');
19+
const [position, setPosition] = React.useState<DrawerProps['position']>('start');
2020

2121
const onClickLeftButton = React.useCallback(() => {
22-
setPosition('left');
22+
setPosition('start');
2323
setIsOpen(true);
2424
}, []);
2525

2626
const onClickRightButton = React.useCallback(() => {
27-
setPosition('right');
27+
setPosition('end');
2828
setIsOpen(true);
2929
}, []);
3030

@@ -42,7 +42,7 @@ export const Position = () => {
4242
/>
4343
}
4444
>
45-
{position === 'left' ? 'Left' : 'Right'} Drawer
45+
{position === 'start' ? 'Left' : 'Right'} Drawer
4646
</DrawerHeaderTitle>
4747
</DrawerHeader>
4848

0 commit comments

Comments
 (0)