-
Notifications
You must be signed in to change notification settings - Fork 209
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
Recipes drag and drop feature #314
Recipes drag and drop feature #314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you!!
- For persisting the indices, I believe you can use the
LocalStorageProvider.ts
(Memento docs) - Is it possible to add some CSS to the dragging item? It'd be great if it had a top white border like the VS Code extension icons do to help the eye track where the items moving too (especially since the tags are full of text).
Screen.Recording.2023-07-20.at.3.56.47.PM.mov
@st0nebraker Thanks for the review. I will make the CSS changes you suggested. |
@st0nebraker I have made all the requested changes for the pre-defined recipes, and also added the state to save the order of it. I think it's all good for review now. REC-20230723210224.mp4 |
@st0nebraker Can I have a review, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!! Just some minor typo, indentation & cleaner conditional css with classNames()
suggestions
vscode/webviews/Recipes.module.css
Outdated
border-top: 2px solid var(--vscode-activityBar-activeBorder | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
border-top: 2px solid var(--vscode-activityBar-activeBorder | |
); | |
border-top: 2px solid var(--vscode-activityBar-activeBorder); |
vscode/webviews/Recipes.tsx
Outdated
className={`${styles.recipeButton} ${ | ||
draggedIndex === index ? styles.recipeButtonDrag : '' | ||
}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className={`${styles.recipeButton} ${ | |
draggedIndex === index ? styles.recipeButtonDrag : '' | |
}`} | |
className={classNames( | |
styles.recipeButton, | |
draggedIndex === index && styles.recipeButtonDrag | |
)} |
@@ -1,3 +1,5 @@ | |||
import { useState } from 'react' | |||
|
|||
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react' | |
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react' | |
import classNames from 'classnames' |
vscode/webviews/Recipes.tsx
Outdated
const initalState = vscodeAPI.getState() as State | undefined | ||
const reorderedRecipeList: RecipeListType = initalState?.reorderedRecipes ?? recipesList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const initalState = vscodeAPI.getState() as State | undefined | |
const reorderedRecipeList: RecipeListType = initalState?.reorderedRecipes ?? recipesList | |
const initialState = vscodeAPI.getState() as State | undefined | |
const reorderedRecipeList: RecipeListType = initialState?.reorderedRecipes ?? recipesList |
@st0nebraker Made all the changes. It's all good to merge now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@st0nebraker Can you merge this PR, please? |
This PR closes #230.
Test plan
Tested it manually.
Run the extension, head over to the recipes section and try to drag and reorder the recipes.
REC-20230719184916.mp4