Skip to content

Commit

Permalink
feat(UsaGraphicList): add support for custom grid prefix for containe…
Browse files Browse the repository at this point in the history
…r class
  • Loading branch information
patrickcate committed Mar 20, 2022
1 parent 6848158 commit 80256e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/UsaGraphicList/UsaGraphicList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script setup>
import { computed } from 'vue'
import { computed, inject } from 'vue'
import { GRID_NAMESPACE } from '@/utils/constants.js'
const gridNamespace = inject('vueUswds.gridNamespace', GRID_NAMESPACE)
const props = defineProps({
variant: {
Expand Down Expand Up @@ -31,11 +34,17 @@ const classes = computed(() => [
'usa-section--light': props.variant === 'light',
},
])
const containerClasses = computed(() =>
props.customClasses?.container?.length
? props.customClasses.container
: [`${gridNamespace}container`]
)
</script>
<template>
<section class="usa-graphic-list usa-section" :class="classes">
<div class="grid-container" :class="customClasses?.container">
<div :class="containerClasses">
<slot :variant="variant"></slot>
</div>
</section>
Expand Down

0 comments on commit 80256e7

Please sign in to comment.