Skip to content

Commit

Permalink
feat: change react-sortable-hoc with react-beautiful-dnd (#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 authored Nov 24, 2023
1 parent e80b088 commit 1f7ab68
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 104 deletions.
10 changes: 10 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ configure({
});

const withContextProvider: Decorator = (Story, context) => {
if (context.parameters?.disableStrictMode) {
return (
<ThemeProvider theme={context.globals.theme}>
<MobileProvider>
<Story {...context} />
</MobileProvider>
</ThemeProvider>
);
}

return (
<React.StrictMode>
<ThemeProvider theme={context.globals.theme}>
Expand Down
145 changes: 120 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
"blueimp-md5": "^2.19.0",
"focus-trap": "^7.5.2",
"lodash": "^4.17.21",
"react-beautiful-dnd": "^13.1.1",
"react-copy-to-clipboard": "^5.1.0",
"react-popper": "^2.3.0",
"react-sortable-hoc": "2.0.0",
"react-transition-group": "^4.4.5",
"react-virtualized-auto-sizer": "^1.0.20",
"react-window": "^1.8.9",
Expand Down Expand Up @@ -122,6 +122,7 @@
"@types/jest": "^29.5.4",
"@types/lodash": "^4.14.197",
"@types/react": "^18.2.21",
"@types/react-beautiful-dnd": "^13.1.7",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^18.2.7",
"@types/react-transition-group": "^4.4.6",
Expand Down
21 changes: 10 additions & 11 deletions src/components/List/List.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ $block: '.#{variables.$ns}list';
&__item {
height: var(--yc-list-item-height);

&_sortable {
cursor: move;
}

&_sorting {
z-index: 100001;
background: var(--g-color-base-simple-hover-solid);
padding: 0 var(--yc-list-margin);
cursor: move;
}

&_active {
background: var(--g-color-base-simple-hover);
}
Expand All @@ -67,6 +56,16 @@ $block: '.#{variables.$ns}list';
margin-right: 0;
}
}

// https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/preset-styles.md#phase-dragging-droppable-element
&_sortable[data-rbd-drag-handle-context-id]:active {
cursor: grabbing;
}

&_dragging {
background: var(--g-color-base-simple-hover-solid);
z-index: 100001;
}
}

&__empty-placeholder {
Expand Down
Loading

0 comments on commit 1f7ab68

Please sign in to comment.