Skip to content

Commit e3ed769

Browse files
committed
Use phila-ui Icon component instead of svgs directly
1 parent 8413225 commit e3ed769

7 files changed

Lines changed: 20 additions & 11 deletions

File tree

apps/philly-311/frontend/src/components/ReportListingCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<script setup lang="ts">
44
import { computed } from 'vue'
55
import { Tags } from '@phila/phila-ui-tags'
6+
import { Icon } from '@phila/phila-ui-core'
67
import { IconImage, IconCircleCheck, IconClock } from '@phila/phila-ui-core/icons'
78
import type { Report } from '@/composables/useNearbyReports'
89
import { statusIconTreatment } from '@/utils/reportCard'
@@ -22,7 +23,7 @@ const statusIcon = computed(() =>
2223
<div class="listing-card__media">
2324
<img v-if="report.mediaUrl" class="listing-card__photo" :src="report.mediaUrl" alt="" />
2425
<div v-else class="listing-card__photo listing-card__photo--placeholder">
25-
<IconImage aria-hidden="true" />
26+
<Icon :icon="IconImage" decorative size="extra-small" />
2627
</div>
2728
</div>
2829
<div class="listing-card__content">
@@ -66,7 +67,6 @@ const statusIcon = computed(() =>
6667
justify-content: center;
6768
background: var(--Schemes-Border-low, #e3e3e3);
6869
color: var(--Schemes-Border, #a1a1a1);
69-
font-size: 1.5rem;
7070
}
7171
.listing-card__content {
7272
display: flex;

apps/philly-311/frontend/src/components/answers/ArticleCard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- ABOUTME: List row for a knowledge article; whole row links to the detail page. -->
22
<script setup lang="ts">
3+
import { Icon } from '@phila/phila-ui-core'
34
import { IconChevronRight } from '@phila/phila-ui-core/icons'
45
import type { Article } from '@/composables/useKnowledgeArticles'
56
@@ -10,7 +11,7 @@ defineProps<{ article: Article }>()
1011
<article class="article-card">
1112
<RouterLink class="article-card__link" :to="`/answers/${article.id}`">
1213
<span class="article-card__title">{{ article.title }}</span>
13-
<IconChevronRight class="article-card__chevron" aria-hidden="true" />
14+
<Icon :icon="IconChevronRight" decorative class="article-card__chevron" />
1415
</RouterLink>
1516
</article>
1617
</template>

apps/philly-311/frontend/src/components/answers/FeaturedArticles.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
(Salesforce featured list view). Hides itself when the fetch fails or is empty. -->
33
<script setup lang="ts">
44
import { onMounted, ref } from 'vue'
5+
import { Icon } from '@phila/phila-ui-core'
56
import { IconStar } from '@phila/phila-ui-core/icons'
67
import { useKnowledgeArticles, type Article } from '@/composables/useKnowledgeArticles'
78
@@ -32,7 +33,7 @@ onMounted(async () => {
3233
<ul v-if="articles.length > 0" class="featured" aria-label="Featured articles">
3334
<li v-for="article in articles" :key="article.id" class="featured__card">
3435
<RouterLink class="featured__link" :to="`/answers/${article.id}`">
35-
<IconStar class="featured__icon" aria-hidden="true" />
36+
<Icon :icon="IconStar" decorative class="featured__icon" />
3637
<span class="featured__title">{{ article.title }}</span>
3738
</RouterLink>
3839
</li>

apps/philly-311/frontend/src/components/answers/__tests__/ArticleCard.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ describe('ArticleCard', () => {
2727
props: { article },
2828
global: { stubs: { RouterLink: RouterLinkStub } },
2929
})
30-
expect(w.find('svg[aria-hidden="true"].article-card__chevron').exists()).toBe(true)
30+
expect(w.find('.article-card__chevron[aria-hidden="true"]').exists()).toBe(true)
3131
})
3232
})

apps/philly-311/frontend/src/pages/AnswersPage.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ArticleCard from '@/components/answers/ArticleCard.vue'
99
import FeaturedArticles from '@/components/answers/FeaturedArticles.vue'
1010
import { PhilaButton } from '@phila/phila-ui-button'
1111
import heroPhoto from '@/assets/answers-hero.jpg'
12+
import { Icon } from '@phila/phila-ui-core'
1213
import { IconMagnifyingGlass, IconSort } from '@phila/phila-ui-core/icons'
1314
1415
const k = useKnowledgeArticles()
@@ -92,12 +93,12 @@ onMounted(loadPage)
9293
class="answers__search-input"
9394
placeholder="Search by topic or keyword"
9495
/>
95-
<IconMagnifyingGlass class="answers__search-icon" aria-hidden="true" />
96+
<Icon :icon="IconMagnifyingGlass" decorative class="answers__search-icon" />
9697
</div>
9798

9899
<div v-if="!isSearching" class="answers__chips">
99100
<label class="answers__chip">
100-
<IconSort class="answers__chip-icon" aria-hidden="true" />
101+
<Icon :icon="IconSort" decorative size="extra-small" />
101102
<select
102103
v-model="sortChoice"
103104
class="answers__chip-select"
@@ -234,9 +235,6 @@ onMounted(loadPage)
234235
border: 1px solid var(--Schemes-Border-low, #d6d6d6);
235236
border-radius: 16px;
236237
}
237-
.answers__chip-icon {
238-
font-size: 0.875rem;
239-
}
240238
.answers__chip-select {
241239
border: none;
242240
background: transparent;

apps/philly-311/frontend/src/pages/__tests__/AnswersPage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('AnswersPage', () => {
4848
expect(w.find('input[type="search"]').attributes('placeholder')).toBe(
4949
'Search by topic or keyword',
5050
)
51-
expect(w.find('.answers__search svg[aria-hidden="true"]').exists()).toBe(true)
51+
expect(w.find('.answers__search .answers__search-icon[aria-hidden="true"]').exists()).toBe(true)
5252
})
5353

5454
it('mounts the featured-articles strip below the hero', async () => {

apps/philly-311/frontend/vitest.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,14 @@ export default defineConfig({
1414
environment: 'jsdom',
1515
globals: true,
1616
setupFiles: ['./src/__tests__/setup.ts'],
17+
// @phila/phila-ui-core's main entry has a side-effect `import './index.css'`.
18+
// Left externalized, Vitest loads it via Node's own resolver, which can't
19+
// handle a bare .css import; inlining routes it through Vite's transform
20+
// instead, which strips/no-ops CSS imports like it does for the real app build.
21+
server: {
22+
deps: {
23+
inline: ['@phila/phila-ui-core'],
24+
},
25+
},
1726
},
1827
})

0 commit comments

Comments
 (0)