feat: enhance UUID component to display multiple UUID versions and Nano ID

- Updated the UUID component to generate and display UUIDs of versions 1, 4, 6, and 7, along with a Nano ID.
- Improved user instructions for generating new UUIDs upon page refresh.
This commit is contained in:
typist
2025-10-28 00:54:38 +08:00
parent 267729f92c
commit f7f34e2797

View File

@@ -1,3 +1,22 @@
import type { FC } from "react";
import { type FC } from "react";
export const UUID: FC = () => <div>UUID</div>
import * as uuid from 'uuid'
import { nanoid } from 'nanoid'
export const UUID: FC = () => {
return (
<div className="flex flex-col gap-4">
<span className="text-sm text-muted-foreground">Refresh the page to generate new UUID</span>
<label>UUID Version 1</label>
<span>{uuid.v1()}</span>
<label>UUID Version 4</label>
<span>{uuid.v4()}</span>
<label>UUID Version 6</label>
<span>{uuid.v6()}</span>
<label>UUID Version 7</label>
<span>{uuid.v7()}</span>
<label>Nano ID</label>
<span>{nanoid()}</span>
</div>
);
};