Skip to content

Commit

Permalink
feat(button): [button] Adapting to the SMB theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Youyou-smiles committed Sep 9, 2024
1 parent 5db8530 commit fc54590
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 44 deletions.
16 changes: 5 additions & 11 deletions examples/sites/demos/pc/app/button/basic-usage-composition-api.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<template>
<tiny-layout>
<p>基本按钮</p>
<tiny-row>
<tiny-button type="primary" native-type="submit"> 主要按钮 </tiny-button>
<tiny-button>次要按钮</tiny-button>
<tiny-button> 次要按钮 </tiny-button>
<tiny-button type="success"> 成功按钮 </tiny-button>
<tiny-button type="info"> 信息按钮 </tiny-button>
<tiny-button type="warning"> 警告按钮 </tiny-button>
<tiny-button type="danger"> 危险按钮 </tiny-button>
</tiny-row>
<p>朴素按钮</p>
<tiny-row>
<tiny-button type="primary" plain> 主要按钮 </tiny-button>
<tiny-button plain>次要按钮 </tiny-button>
<tiny-button plain> 次要按钮 </tiny-button>
<tiny-button type="success" plain> 成功按钮 </tiny-button>
<tiny-button type="info" plain> 信息按钮 </tiny-button>
<tiny-button type="warning" plain> 警告按钮 </tiny-button>
<tiny-button type="danger" plain> 危险按钮 </tiny-button>
</tiny-row>
<tiny-row>
<tiny-button type="primary" round> 主要按钮 </tiny-button>
<tiny-button round> 圆角按钮 </tiny-button>
<tiny-button type="success" round> 成功按钮 </tiny-button>
<tiny-button type="info" round> 信息按钮 </tiny-button>
<tiny-button type="warning" round> 警告按钮 </tiny-button>
<tiny-button type="danger" round> 危险按钮 </tiny-button>
</tiny-row>
<tiny-row>
<tiny-button :icon="IconSearch" circle></tiny-button>
<tiny-button type="primary" :icon="IconEdit" circle></tiny-button>
Expand All @@ -49,7 +43,7 @@ const IconSearch = iconSearch()

<style scoped>
.tiny-row {
margin-bottom: 20px;
margin: 20px 0;
}
.tiny-button {
margin-bottom: 10px;
Expand Down
22 changes: 0 additions & 22 deletions examples/sites/demos/pc/app/button/basic-usage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,3 @@ test('测试朴素按钮', async ({ page }) => {
await expect(page.getByRole('button', { name: '警告按钮' }).nth(1)).toHaveClass(/tiny-button--warning is-plain/)
await expect(page.getByRole('button', { name: '危险按钮' }).nth(1)).toHaveClass(/tiny-button--danger is-plain/)
})

test('测试圆角按钮', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('button#base')
await expect(page.getByRole('button', { name: '圆角按钮' })).toHaveClass(/is-round/)
await expect(page.getByRole('button', { name: '主要按钮' }).nth(2)).toHaveClass(/tiny-button--primary is-round/)
await expect(page.getByRole('button', { name: '成功按钮' }).nth(2)).toHaveClass(/tiny-button--success is-round/)
await expect(page.getByRole('button', { name: '信息按钮' }).nth(2)).toHaveClass(/tiny-button--info is-round/)
await expect(page.getByRole('button', { name: '警告按钮' }).nth(2)).toHaveClass(/tiny-button--warning is-round/)
await expect(page.getByRole('button', { name: '危险按钮' }).nth(2)).toHaveClass(/tiny-button--danger is-round/)
})

test('测试是否是圆形按钮', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('button#base')
await expect(page.getByRole('button', { name: '圆角按钮' })).toHaveClass(/tiny-button--default/)
await expect(page.getByRole('button', { name: '主要按钮' }).nth(2)).toHaveClass(/tiny-button--primary/)
await expect(page.locator('button:nth-child(3)').first()).toHaveClass(/tiny-button--success/)
await expect(page.locator('button:nth-child(4)').first()).toHaveClass(/tiny-button--info/)
await expect(page.locator('button:nth-child(5)').first()).toHaveClass(/tiny-button--warning/)
await expect(page.locator('button:nth-child(6)').first()).toHaveClass(/tiny-button--danger/)
})
16 changes: 5 additions & 11 deletions examples/sites/demos/pc/app/button/basic-usage.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<template>
<tiny-layout>
<p>基本按钮</p>
<tiny-row>
<tiny-button type="primary" native-type="submit"> 主要按钮 </tiny-button>
<tiny-button>次要按钮</tiny-button>
<tiny-button> 次要按钮 </tiny-button>
<tiny-button type="success"> 成功按钮 </tiny-button>
<tiny-button type="info"> 信息按钮 </tiny-button>
<tiny-button type="warning"> 警告按钮 </tiny-button>
<tiny-button type="danger"> 危险按钮 </tiny-button>
</tiny-row>
<p>朴素按钮</p>
<tiny-row>
<tiny-button type="primary" plain> 主要按钮 </tiny-button>
<tiny-button plain>次要按钮 </tiny-button>
<tiny-button plain> 次要按钮 </tiny-button>
<tiny-button type="success" plain> 成功按钮 </tiny-button>
<tiny-button type="info" plain> 信息按钮 </tiny-button>
<tiny-button type="warning" plain> 警告按钮 </tiny-button>
<tiny-button type="danger" plain> 危险按钮 </tiny-button>
</tiny-row>
<tiny-row>
<tiny-button type="primary" round> 主要按钮 </tiny-button>
<tiny-button round> 圆角按钮 </tiny-button>
<tiny-button type="success" round> 成功按钮 </tiny-button>
<tiny-button type="info" round> 信息按钮 </tiny-button>
<tiny-button type="warning" round> 警告按钮 </tiny-button>
<tiny-button type="danger" round> 危险按钮 </tiny-button>
</tiny-row>
<tiny-row>
<tiny-button :icon="IconSearch" circle></tiny-button>
<tiny-button type="primary" :icon="IconEdit" circle></tiny-button>
Expand Down Expand Up @@ -60,7 +54,7 @@ export default {

<style scoped>
.tiny-row {
margin-bottom: 20px;
margin: 20px 0;
}
.tiny-button {
margin-bottom: 10px;
Expand Down

0 comments on commit fc54590

Please sign in to comment.