Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
@layer components {
.bcc-nps-result {
@apply relative w-full;
}
.bcc-nps-result {
@apply relative w-full;
}

.bcc-nps-result.xs {
@apply w-24;
}
.bcc-nps-result.sm {
@apply w-36;
}
.bcc-nps-result.md {
@apply w-48;
}
.bcc-nps-result.lg {
@apply w-60;
}
.bcc-nps-result.xl {
@apply w-72;
}
.bcc-nps-result.xs {
@apply w-24;
}
.bcc-nps-result.sm {
@apply w-36;
}
.bcc-nps-result.md {
@apply w-48;
}
.bcc-nps-result.lg {
@apply w-60;
}
.bcc-nps-result.xl {
@apply w-72;
}

.bcc-nps-result .bcc-nps-result-gauge-dial {
transform-origin: center;
}
.bcc-nps-result .bcc-nps-result-gauge-dial {
transform-origin: center;
}

.bcc-nps-result.animated .bcc-nps-result-gauge-dial {
transition-delay: 0.3s;
transition: all .7s cubic-bezier(0, 0, 0.3, 1.5);
}
.bcc-nps-result.animated .bcc-nps-result-gauge-dial {
transition-delay: 0.3s;
transition: all 0.7s cubic-bezier(0, 0, 0.3, 1.5);
}

.bcc-nps-result-labels {
@apply absolute text-base bottom-1/4 translate-y-1/2 flex w-full flex-col items-center justify-center;
}
.bcc-nps-result-labels {
@apply absolute bottom-0 flex w-full flex-col items-center justify-center text-base;
}

.bcc-nps-result-labels--heading {
@apply text-[1.25em] font-semibold leading-none;
}
.bcc-nps-result-labels--label {
@apply text-[0.75em] text-subtlest;
}
.bcc-nps-result-labels--heading {
@apply text-[1.25em] leading-none font-semibold;
}
.bcc-nps-result-labels--label {
@apply text-subtlest text-[0.75em];
}
.bcc-nps-result-labels--title {
@apply heading-sm text-subtle mt-0.5;
}

.bcc-nps-result.md .bcc-nps-result-labels {
@apply text-lg;
}
.bcc-nps-result.lg .bcc-nps-result-labels {
@apply text-xl;
}
.bcc-nps-result.xl .bcc-nps-result-labels {
@apply text-2xl;
}
.bcc-nps-result.full .bcc-nps-result-labels {
@apply text-lg;
}
.bcc-nps-result.md .bcc-nps-result-labels {
@apply text-lg;
}
.bcc-nps-result.lg .bcc-nps-result-labels {
@apply text-xl;
}
.bcc-nps-result.xl .bcc-nps-result-labels {
@apply text-2xl;
}
.bcc-nps-result.full .bcc-nps-result-labels {
@apply text-lg;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const meta: Meta<typeof BccNpsResult> = {
},
display: { control: 'text', description: 'Custom text to show instead of score' },
underline: { control: 'text', description: 'Label below the score' },
title: { control: 'text', description: 'Title shown below the underline' },
hideText: { control: 'boolean' },
animated: { control: 'boolean' },
},
Expand Down Expand Up @@ -50,6 +51,21 @@ export const Sizes: Story = {
}),
};

export const WithTitle: Story = {
args: {
score: 30,
underline: 'Average Score',
title: 'Title',
},
render: args => ({
components: { BccNpsResult },
setup() {
return { args };
},
template: `<BccNpsResult v-bind="args" />`,
}),
};

export const WithCustomText: Story = {
args: {
score: 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type NpsResultProps = {
display?: string;
/** Secondary label shown under the main heading. */
underline?: string;
/** Title shown below the underline. */
title?: string;
/** When true, hides the heading and underline so only the gauge is shown. */
hideText?: boolean;
/** When true, the gauge needle animates to the score on mount/update. */
Expand Down Expand Up @@ -96,6 +98,7 @@ const degrees = computed(() => {
<div v-if="!hideText && size !== 'xs'" class="bcc-nps-result-labels">
<h3 class="bcc-nps-result-labels--heading">{{ display ?? score }}</h3>
<label class="bcc-nps-result-labels--label">{{ underline }}</label>
<span v-if="title" class="bcc-nps-result-labels--title">{{ title }}</span>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`BccNpsResult > renders a nps result 1`] = `
</svg>
<div class="bcc-nps-result-labels">
<h3 class="bcc-nps-result-labels--heading">20</h3><label class="bcc-nps-result-labels--label"></label>
<!--v-if-->
</div>
</div>"
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@layer components {
.bcc-nps-score {
@apply body-sm flex min-w-70 flex-col gap-y-2 p-4 select-none;
@apply body-md flex min-w-70 flex-col gap-y-1.5 p-4 select-none;
}

.bcc-nps-score--heading {
Expand Down