-
Notifications
You must be signed in to change notification settings - Fork 49
feat: add fontFamily input #548
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
base: main
Are you sure you want to change the base?
Conversation
|
| function Sortable({ id, index, children }: SortableProps) { | ||
| const { ref } = useSortable({ id, index }); | ||
|
|
||
| return ( | ||
| <li ref={ref} className={c.item}> | ||
| <CaretSort /> | ||
| {children} | ||
| </li> | ||
| ); | ||
| } | ||
|
|
||
| // function SortableList() { | ||
| // const items = [1, 2, 3, 4]; | ||
|
|
||
| // return ( | ||
| // <ul className={c.list}> | ||
| // {items.map((id, index) => ( | ||
| // <Sortable key={id} id={id} index={index} /> | ||
| // ))} | ||
| // </ul> | ||
| // ); | ||
| // } |
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.
TODO: pull sortable out into a reusable component
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.
TODO: adjust behavior of sorting so that items don't move until dropped. This is probably deferrable since it's a UX issue. There are other higher priority concerns.
Here's a demo of the desirable behavior though: https://shadcn-drag-and-drop.vercel.app/
| </DragDropProvider> | ||
| <div> | ||
| <Button type='button' onClick={addFontFamily} size='s'> | ||
| + Add Font Family |
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.
TODO: add plus icon
|
|
||
| return ( | ||
| <li ref={ref} className={c.item}> | ||
| <CaretSort /> |
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.
TODO: add drag handle icon
| import { move } from '@dnd-kit/helpers'; | ||
| import { DragDropProvider } from '@dnd-kit/react'; | ||
| import { useSortable } from '@dnd-kit/react/sortable'; |
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.
@drwpow I have this as a draft PR because I'd like to get your thoughts on using this package before going further. Are there alternatives we should explore instead?
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.
Nah go for it. For the token lab we can add anything here. DND is a great library (used it a little, liked it)
Changes
Adds sortable font family input
tz-font-family.mov
How to Review
How can a reviewer review your changes? What should be kept in mind for this review?