-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #493 from 3YOURMIND/refactor-kt-button-group
refactor(KtButtonGroup): Proper TypeScript Types
- Loading branch information
Showing
6 changed files
with
29 additions
and
32 deletions.
There are no files selected for viewing
45 changes: 16 additions & 29 deletions
45
packages/kotti-ui/source/kotti-button-group/KtButtonGroup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,36 @@ | ||
<template> | ||
<div :class="objectClass"> | ||
<div class="kt-button-group"> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
<script lang="ts"> | ||
import { defineComponent } from '@vue/composition-api' | ||
import { KottiButtonGroup } from './types' | ||
export default defineComponent<KottiButtonGroup.PropsInternal>({ | ||
name: 'KtButtonGroup', | ||
props: { | ||
shadow: Boolean, | ||
}, | ||
computed: { | ||
objectClass() { | ||
return { | ||
'button-group': true, | ||
'button-group--shadow': this.shadow, | ||
} | ||
}, | ||
}, | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss"> | ||
@import '../kotti-style/_variables.scss'; | ||
.button-group { | ||
/** Fix for inline element space | ||
https://css-tricks.com/fighting-the-space-between-inline-block-elements/ **/ | ||
font-size: 0; | ||
.kt-button-group { | ||
font-size: 0; /* Fix for inline element space https://css-tricks.com/fighting-the-space-between-inline-block-elements/ */ | ||
.kt-button { | ||
font-size: $font-size; | ||
border-radius: 0; | ||
} | ||
.kt-button:first-of-type { | ||
border-radius: $border-radius 0 0 $border-radius; | ||
} | ||
.kt-button:last-of-type { | ||
border-radius: 0 $border-radius $border-radius 0; | ||
} | ||
&:first-of-type { | ||
border-radius: $border-radius 0 0 $border-radius; | ||
} | ||
&--shadow { | ||
box-shadow: 0 1px 2px rgba($color: #000000, $alpha: 0.24); | ||
&:last-of-type { | ||
border-radius: 0 $border-radius $border-radius 0; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SpecifyRequiredProps } from '../types/utilities' | ||
|
||
export namespace KottiButtonGroup { | ||
export type PropsInternal = {} | ||
|
||
export type Props = SpecifyRequiredProps<PropsInternal, never> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters