mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
refactor(ui): update button elements to include type attribute
- Added type="button" to button elements in DividerWithText and Icon stories for better accessibility and to prevent unintended form submissions. - Improved code consistency across button components in the UI stories.
This commit is contained in:
parent
f83c3e171e
commit
56af6f43c0
@ -92,12 +92,18 @@ export const MultipleUsage: Story = {
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</div>
|
||||
<button className="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700">登录</button>
|
||||
<button type="button" className="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700">
|
||||
登录
|
||||
</button>
|
||||
|
||||
<DividerWithText text="或" />
|
||||
|
||||
<button className="w-full border border-gray-300 py-2 rounded-md hover:bg-gray-50">使用 Google 登录</button>
|
||||
<button className="w-full border border-gray-300 py-2 rounded-md hover:bg-gray-50">使用 GitHub 登录</button>
|
||||
<button type="button" className="w-full border border-gray-300 py-2 rounded-md hover:bg-gray-50">
|
||||
使用 Google 登录
|
||||
</button>
|
||||
<button type="button" className="w-full border border-gray-300 py-2 rounded-md hover:bg-gray-50">
|
||||
使用 GitHub 登录
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -178,13 +178,13 @@ export const IconStates: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-4">
|
||||
<button className="rounded p-2 hover:bg-gray-100">
|
||||
<button type="button" className="rounded p-2 hover:bg-gray-100">
|
||||
<EditIcon size={20} />
|
||||
</button>
|
||||
<button className="rounded p-2 hover:bg-gray-100" disabled>
|
||||
<button type="button" className="rounded p-2 hover:bg-gray-100" disabled>
|
||||
<EditIcon size={20} className="opacity-50" />
|
||||
</button>
|
||||
<button className="rounded bg-blue-500 p-2 text-white hover:bg-blue-600">
|
||||
<button type="button" className="rounded bg-blue-500 p-2 text-white hover:bg-blue-600">
|
||||
<EditIcon size={20} />
|
||||
</button>
|
||||
</div>
|
||||
@ -205,13 +205,13 @@ export const InContext: Story = {
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="font-semibold">Document.pdf</h3>
|
||||
<div className="flex gap-2">
|
||||
<button className="rounded p-1 hover:bg-gray-100">
|
||||
<button type="button" className="rounded p-1 hover:bg-gray-100">
|
||||
<CopyIcon size={16} />
|
||||
</button>
|
||||
<button className="rounded p-1 hover:bg-gray-100">
|
||||
<button type="button" className="rounded p-1 hover:bg-gray-100">
|
||||
<EditIcon size={16} />
|
||||
</button>
|
||||
<button className="rounded p-1 hover:bg-gray-100">
|
||||
<button type="button" className="rounded p-1 hover:bg-gray-100">
|
||||
<DeleteIcon size={16} />
|
||||
</button>
|
||||
</div>
|
||||
@ -224,7 +224,9 @@ export const InContext: Story = {
|
||||
<span className="font-medium">Image Processing</span>
|
||||
</div>
|
||||
<p className="mb-3 text-sm text-gray-600">Process your images with advanced AI tools</p>
|
||||
<button className="flex items-center gap-2 rounded bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600">
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center gap-2 rounded bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600">
|
||||
<OcrIcon size={16} />
|
||||
<span>Extract Text</span>
|
||||
</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user