Updated button badges

pull/5806/head
Cagatay Civici 2024-05-25 14:42:57 +03:00
parent eb4523a934
commit 1ff84519e4
8 changed files with 24 additions and 22 deletions

View File

@ -32,7 +32,7 @@ export default {
}, },
badgeSeverity: { badgeSeverity: {
type: String, type: String,
default: null default: 'secondary'
}, },
loading: { loading: {
type: Boolean, type: Boolean,

View File

@ -16,7 +16,8 @@ const theme = ({ dt }) => `
font-size: 1rem; font-size: 1rem;
font-family: inherit; font-family: inherit;
font-feature-settings: inherit; font-feature-settings: inherit;
transition: background ${dt('button.transition.duration')}, color ${dt('button.transition.duration')}, border-color ${dt('button.transition.duration')}, outline-color ${dt('button.transition.duration')}, box-shadow ${dt('button.transition.duration')}; transition: background ${dt('button.transition.duration')}, color ${dt('button.transition.duration')}, border-color ${dt('button.transition.duration')},
outline-color ${dt('button.transition.duration')}, box-shadow ${dt('button.transition.duration')};
border-radius: ${dt('button.border.radius')}; border-radius: ${dt('button.border.radius')};
outline-color: transparent; outline-color: transparent;
gap: ${dt('button.gap')}; gap: ${dt('button.gap')};
@ -99,11 +100,9 @@ const theme = ({ dt }) => `
} }
.p-button .p-badge { .p-button .p-badge {
min-width: 1rem; min-width: ${dt('button.badge.size')};
height: 1rem; height: ${dt('button.badge.size')};
line-height: 1rem; line-height: ${dt('button.badge.size')};
background: ${dt('button.primary.color')};
color: ${dt('button.primary.background')};
} }
.p-button-raised { .p-button-raised {

View File

@ -25,6 +25,7 @@ export default {
style: '{focus.ring.style}', style: '{focus.ring.style}',
offset: '{focus.ring.offset}' offset: '{focus.ring.offset}'
}, },
badgeSize: '1rem',
transitionDuration: '{form.field.transition.duration}' transitionDuration: '{form.field.transition.duration}'
}, },
colorScheme: { colorScheme: {

View File

@ -25,6 +25,7 @@ export default {
style: '{form.field.focus.ring.style}', style: '{form.field.focus.ring.style}',
offset: '{form.field.focus.ring.offset}' offset: '{form.field.focus.ring.offset}'
}, },
badgeSize: '1rem',
transitionDuration: '{form.field.transition.duration}' transitionDuration: '{form.field.transition.duration}'
}, },
colorScheme: { colorScheme: {

View File

@ -25,6 +25,7 @@ export default {
style: '{focus.ring.style}', style: '{focus.ring.style}',
offset: '{focus.ring.offset}' offset: '{focus.ring.offset}'
}, },
badgeSize: '1rem',
transitionDuration: '{form.field.transition.duration}' transitionDuration: '{form.field.transition.duration}'
}, },
colorScheme: { colorScheme: {

View File

@ -2,9 +2,9 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Buttons have built-in support for badges to display a badge inline.</p> <p>Buttons have built-in support for badges to display a badge inline.</p>
</DocSectionText> </DocSectionText>
<div class="card flex flex-wrap justify-center gap-2"> <div class="card flex justify-center flex-wrap gap-4">
<Button type="button" label="Emails" badge="8" /> <Button type="button" label="Notifications" icon="pi pi-bell" badge="2" />
<Button type="button" label="Messages" icon="pi pi-users" severity="secondary" badge="4" badgeSeverity="info" /> <Button type="button" label="Inbox" icon="pi pi-inbox" badge="2" badgeSeverity="contrast" outlined />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,14 +15,14 @@ export default {
return { return {
code: { code: {
basic: ` basic: `
<Button type="button" label="Emails" badge="8" /> <Button type="button" label="Notifications" icon="pi pi-bell" badge="2" />
<Button type="button" label="Messages" icon="pi pi-users" severity="secondary" badge="4" badgeSeverity="info" /> <Button type="button" label="Inbox" icon="pi pi-inbox" badge="2" badgeSeverity="contrast" outlined />
`, `,
options: ` options: `
<template> <template>
<div class="card flex flex-wrap justify-center gap-2"> <div class="card flex justify-center flex-wrap gap-4">
<Button type="button" label="Emails" badge="8" /> <Button type="button" label="Notifications" icon="pi pi-bell" badge="2" />
<Button type="button" label="Messages" icon="pi pi-users" severity="secondary" badge="4" badgeSeverity="info" /> <Button type="button" label="Inbox" icon="pi pi-inbox" badge="2" badgeSeverity="contrast" outlined />
</div> </div>
</template> </template>
@ -31,9 +31,9 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex flex-wrap justify-center gap-2"> <div class="card flex justify-center flex-wrap gap-4">
<Button type="button" label="Emails" badge="8" /> <Button type="button" label="Notifications" icon="pi pi-bell" badge="2" />
<Button type="button" label="Messages" icon="pi pi-users" severity="secondary" badge="4" badgeSeverity="info" /> <Button type="button" label="Inbox" icon="pi pi-inbox" badge="2" badgeSeverity="contrast" outlined />
</div> </div>
</template> </template>

View File

@ -12,7 +12,7 @@
<script> <script>
import AccessibilityDoc from '@/doc/button/AccessibilityDoc.vue'; import AccessibilityDoc from '@/doc/button/AccessibilityDoc.vue';
import BadgesDoc from '@/doc/button/BadgesDoc.vue'; import BadgeDoc from '@/doc/button/BadgeDoc.vue';
import BasicDoc from '@/doc/button/BasicDoc.vue'; import BasicDoc from '@/doc/button/BasicDoc.vue';
import ButtonGroupDoc from '@/doc/button/ButtonGroupDoc.vue'; import ButtonGroupDoc from '@/doc/button/ButtonGroupDoc.vue';
import DisabledDoc from '@/doc/button/DisabledDoc.vue'; import DisabledDoc from '@/doc/button/DisabledDoc.vue';
@ -102,9 +102,9 @@ export default {
component: IconOnlyDoc component: IconOnlyDoc
}, },
{ {
id: 'badges', id: 'badge',
label: 'Badges', label: 'Badge',
component: BadgesDoc component: BadgeDoc
}, },
{ {
id: 'buttongroup', id: 'buttongroup',