Skip to content

Conversation

@davejsdev
Copy link
Collaborator

@davejsdev davejsdev commented Sep 25, 2025

Changes

Adds sortable font family input

image
tz-font-family.mov

How to Review

How can a reviewer review your changes? What should be kept in mind for this review?

  1. Go to the typography section
  2. add, remove, edit, reorder font families

@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2025

⚠️ No Changeset found

Latest commit: 34f491e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +16 to +37
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>
// );
// }
Copy link
Collaborator Author

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

Copy link
Collaborator Author

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
Copy link
Collaborator Author

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 />
Copy link
Collaborator Author

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

Comment on lines +1 to +3
import { move } from '@dnd-kit/helpers';
import { DragDropProvider } from '@dnd-kit/react';
import { useSortable } from '@dnd-kit/react/sortable';
Copy link
Collaborator Author

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?

Copy link
Collaborator

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants