Skip to content

Commit 6fed913

Browse files
committed
feat: Clearer content regarding Butter CMS component library usage vs inline components
1 parent 70ff184 commit 6fed913

File tree

5 files changed

+32
-13
lines changed

5 files changed

+32
-13
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Detect bloated HTML attributes introduced when content is pasted from external t
4747
- Shows context snippets around each finding for manual review
4848

4949
### Component Usage Audit
50-
Audit which of your known Butter CMS components are actually used across individual pages — complementing Butter CMS's built-in view, which shows which page types reference a component:
51-
- Add your component slugs to the Known Components configuration
50+
Audit which of your Butter CMS **component library** components are actually used across individual pages — complementing Butter CMS's built-in view, which shows which page types reference a component. This applies to reusable components created in the Butter CMS component library, not to inline components defined directly within a page type:
51+
- Add your component library slugs to the Component Library configuration
5252
- Scans all fields recursively — detects both object key-based and `type` field-based component references
53-
- Shows usage counts for each known component with a list of individual pages where it appears
53+
- Shows usage counts for each component library component with a list of individual pages where it appears
5454
- Warns when a component has zero individual page usages, noting that Butter CMS may still reference it at the page type level
5555

5656
## 🔧 Development

src/components/ApiConfiguration.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ describe('ApiConfiguration.vue', () => {
809809
describe('Known Components Section', () => {
810810
it('renders known components section heading', () => {
811811
const wrapper = mount(ApiConfiguration)
812-
expect(wrapper.text()).toContain('Components')
812+
expect(wrapper.text()).toContain('Component Library')
813813
})
814814

815815
it('renders the known component TextInput', () => {
@@ -823,7 +823,7 @@ describe('ApiConfiguration.vue', () => {
823823
store.knownComponents = []
824824

825825
const wrapper = mount(ApiConfiguration)
826-
expect(wrapper.text()).toContain('No known components configured yet')
826+
expect(wrapper.text()).toContain('No component library components configured yet')
827827
})
828828

829829
it('does not show Add button when known component input is empty', () => {

src/components/ApiConfiguration.vue

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@
121121

122122
<!-- Components Section -->
123123
<div class="api-config__section">
124-
<h3 class="api-config__section-title">Components</h3>
124+
<h3 class="api-config__section-title">Component Library</h3>
125+
<p class="api-config__section-description">
126+
Add slugs for components from your Butter CMS <strong>component library</strong> only —
127+
these are reusable, shared components created independently and added to page types.
128+
Inline components defined directly within a page type are not tracked.
129+
</p>
125130
<form @submit.prevent="addKnownComponent" novalidate class="api-config__form">
126131
<TextInput
127132
id="known-component-input"
@@ -130,7 +135,9 @@
130135
root-class="api-config__input"
131136
placeholder="e.g. hero_banner, cta_block, testimonial"
132137
>
133-
<template v-slot:label>Add Component Slug (comma-separated for multiple)</template>
138+
<template v-slot:label
139+
>Add Component Library Slug (comma-separated for multiple)</template
140+
>
134141
</TextInput>
135142
<Btn
136143
v-if="knownComponentInput"
@@ -147,7 +154,7 @@
147154
</Chip>
148155
</li>
149156
</ul>
150-
<p v-else class="api-config__empty">No known components configured yet</p>
157+
<p v-else class="api-config__empty">No component library components configured yet</p>
151158
</div>
152159
</div>
153160
</Accordion>
@@ -379,10 +386,17 @@ function removeKnownComponent(component: string): void {
379386
&__section-title {
380387
font-size: var(--font-size-lg);
381388
font-weight: 600;
382-
margin: 0 0 var(--space-4) 0;
389+
margin: 0 0 var(--space-2) 0;
383390
color: var(--text-primary);
384391
}
385392
393+
&__section-description {
394+
font-size: var(--font-size-sm);
395+
color: var(--text-secondary);
396+
line-height: var(--line-height-relaxed);
397+
margin: 0 0 var(--space-4) 0;
398+
}
399+
386400
&__form {
387401
display: flex;
388402
gap: var(--space-3);

src/components/Features/ComponentsContent.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('ComponentsContent.vue', () => {
5656
it('shows warning when no known components configured', () => {
5757
store.knownComponents = []
5858
const wrapper = mountComponent()
59-
expect(wrapper.text()).toContain('No known components configured')
59+
expect(wrapper.text()).toContain('No known component library components configured')
6060
})
6161

6262
it('does not show ScopeSelection when no known components configured', () => {

src/components/Features/ComponentsContent.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<template>
22
<UtilitySection
33
title="Component Usage Audit"
4-
description="Identify which of your known Butter CMS components are actually used across individual pages. Unlike Butter CMS's built-in view (which shows which page types reference a component), this tool shows which individual pages use each component — so you can spot components with zero real-world page usages."
4+
description="Identify which of your Butter CMS component library components are actually used across individual pages. This applies to reusable components created in the Butter CMS component library — not to inline components defined directly within a page type. Unlike Butter CMS's built-in view (which shows which page types reference a component), this tool shows which individual pages use each component — so you can spot components with zero real-world page usages."
55
>
66
<!-- Info Banner -->
77
<InfoBanner status="info" class="components-content__info">
8+
<strong>Component library only:</strong> This tool tracks components from your Butter CMS
9+
<em>component library</em> — reusable, shared components created independently and added to
10+
page types. It does <strong>not</strong> track inline components defined directly within a
11+
page type (local components that are not part of the shared library). Only add slugs for
12+
component library components in API Configuration. <br /><br />
813
<strong>Page types only:</strong> Components are only available in page types — blog posts and
914
collections do not support Butter CMS components. Ensure all of your page types are added in
1015
API Configuration and all are selected below for a complete analysis. A component showing
@@ -19,8 +24,8 @@
1924

2025
<!-- Guard: no known components configured -->
2126
<InfoBanner v-if="store.knownComponents.length === 0" status="warning">
22-
No known components configured. Add your component slugs in
23-
<strong>API Configuration → Known Components</strong> above to run an analysis.
27+
No known component library components configured. Add your component library slugs in
28+
<strong>API Configuration → Component Library</strong> above to run an analysis.
2429
</InfoBanner>
2530

2631
<!-- Scope Selection (page types only) -->

0 commit comments

Comments
 (0)