Skip to content

Commit

Permalink
refactor: remove spacing prop from all components
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Feb 18, 2023
1 parent 4f7c587 commit f70d632
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 23 deletions.
3 changes: 1 addition & 2 deletions packages/anu-vue/src/components/alert/AAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import type { ExtractPropTypes } from 'vue'
import { useInternalBooleanState } from '@/composables/useInternalBooleanState'
import { useLayer, useProps as useLayerProps } from '@/composables/useLayer'
import { configurable as configurableProp, spacing as spacingProp } from '@/composables/useProps'
import { configurable as configurableProp } from '@/composables/useProps'
const props = defineProps({
spacing: spacingProp,
...useLayerProps({
color: {
Expand Down
3 changes: 1 addition & 2 deletions packages/anu-vue/src/components/avatar/props.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { ExtractPropTypes } from 'vue'
import { useProps as useLayerProps } from '@/composables/useLayer'
import { configurable, spacing } from '@/composables/useProps'
import { configurable } from '@/composables/useProps'

export const avatarProps = {
spacing,

...useLayerProps({
color: {
Expand Down
3 changes: 1 addition & 2 deletions packages/anu-vue/src/components/badge/ABadge.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<script lang="ts" setup>
import { defu } from 'defu'
import type { PropType } from 'vue'
import { color as colorProp, spacing as spacingProp } from '@/composables/useProps'
import { color as colorProp } from '@/composables/useProps'
import { isNumeric } from '@/utils/helpers'
type VerticalAnchor = 'top' | 'bottom'
type HorizontalAnchor = 'left' | 'right'
type Anchor = `${VerticalAnchor} ${HorizontalAnchor}`
const props = defineProps({
spacing: spacingProp,
/**
* Show/Hide badge based on v-model value
Expand Down
6 changes: 1 addition & 5 deletions packages/anu-vue/src/components/base-input/props.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { ExtractPropTypes, HTMLAttributes, PropType } from 'vue'
import { configurable, disabled, readonly, spacing } from '@/composables/useProps'
import { configurable, disabled, readonly } from '@/composables/useProps'

// TODO: Provide a way to apply classes on root. Later you can target input container & wrapper.
export const baseInputProps = {
/**
* Component spacing
*/
spacing,

/**
* Input wrapper classes
Expand Down
3 changes: 1 addition & 2 deletions packages/anu-vue/src/components/btn/ABtn.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { ASpinner } from '@/components/spinner'
import { useLayer, useProps as useLayerProps } from '@/composables/useLayer'
import { configurable as configurableProp, disabled as disabledProp, spacing as spacingProp } from '@/composables/useProps'
import { configurable as configurableProp, disabled as disabledProp } from '@/composables/useProps'
const props = defineProps({
...useLayerProps({
Expand All @@ -15,7 +15,6 @@ const props = defineProps({
default: true,
},
}),
spacing: spacingProp,
icon: configurableProp,
appendIcon: configurableProp,
iconOnly: Boolean,
Expand Down
2 changes: 0 additions & 2 deletions packages/anu-vue/src/components/card/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import type { ExtractPropTypes, PropType } from 'vue'
import type { LoaderProps } from '@/components/loader/props'
import { typographyProps } from '@/components/typography/props'
import { useProps as useLayerProps } from '@/composables/useLayer'
import { spacing } from '@/composables/useProps'

export const cardProps = {
...useLayerProps(),
...typographyProps,
spacing,

/**
* Render image at the top of the card (_above header_)
Expand Down
6 changes: 0 additions & 6 deletions packages/anu-vue/src/components/table/props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { PropType } from 'vue'
import { spacing } from '@/composables/useProps'

export interface PropColumn {
name: string
Expand Down Expand Up @@ -32,9 +31,4 @@ export const tableProps = {
type: String,
default: 'No records found!',
},

/**
* Component spacing
*/
spacing,
}
2 changes: 0 additions & 2 deletions packages/anu-vue/src/composables/useProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const disabled = { type: Boolean } as const

export const readonly = { type: Boolean } as const

export const spacing = { type: Number } as const

export const configurable = { type: [Array, String, Number, Object, undefined] as PropType<ConfigurableValue> } as const

// TODO: Use this prop merger
Expand Down

0 comments on commit f70d632

Please sign in to comment.