-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
196 additions
and
17 deletions.
There are no files selected for viewing
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 +1,2 @@ | ||
export * from './alert.vue'; | ||
export { default as Alert } from './alert.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
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,5 @@ | ||
export * from './button.vue'; | ||
export { default as Button } from './button.vue'; | ||
|
||
export * from './link-button.vue'; | ||
export { default as LinkButton } from './link-button.vue'; |
126 changes: 126 additions & 0 deletions
126
packages/celeste-vue/src/components/button/link-button.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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<script setup lang="ts"> | ||
import type { HTMLAttributes } from 'vue'; | ||
import clsx from 'clsx'; | ||
import { Primitive, type PrimitiveProps } from 'radix-vue'; | ||
const props = withDefaults(defineProps<LinkButtonProps>(), { | ||
size: 'sm', | ||
type: 'primary', | ||
as: 'a', | ||
}); | ||
</script> | ||
|
||
<script lang="ts"> | ||
export interface LinkButtonProps extends PrimitiveProps { | ||
class?: HTMLAttributes['class']; | ||
size?: 'sm' | 'md'; | ||
type?: 'primary' | 'black' | 'gray' | 'error'; | ||
underline?: boolean; | ||
disabled?: boolean; | ||
} | ||
</script> | ||
|
||
<template> | ||
<Primitive | ||
:as | ||
:disabled | ||
:as-child | ||
:class="clsx( | ||
'celeste-link-button', | ||
`celeste-link-button-${type}`, | ||
`celeste-link-button-${size}`, | ||
disabled && 'celeste-link-button-disabled', | ||
underline && 'celeste-link-button-underline', | ||
props.class, | ||
)" | ||
:role="as === 'a' ? 'link' : 'button'" | ||
> | ||
<slot /> | ||
</Primitive> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.celeste-link-button { | ||
display: inline-flex; | ||
align-items: center; | ||
text-decoration: none; | ||
justify-content: center; | ||
transition-property: color, text-decoration-color; | ||
transition-timing-function: ease-out; | ||
transition-duration: var(--animation-fast); | ||
cursor: pointer; | ||
&:disabled, | ||
&-disabled { | ||
cursor: default; | ||
pointer-events: none; | ||
color: var(--color-text-disabled-300); | ||
} | ||
&:hover, | ||
&:focus { | ||
outline: none; | ||
text-decoration: underline; | ||
} | ||
&-underline { | ||
text-decoration: underline; | ||
} | ||
&-md { | ||
height: 20px; | ||
font: var(--label-sm); | ||
i { | ||
height: 20px; | ||
width: 20px; | ||
} | ||
} | ||
&-sm { | ||
height: 16px; | ||
font: var(--label-xs); | ||
i { | ||
height: 16px; | ||
width: 16px; | ||
} | ||
} | ||
&-primary:not(&-disabled) { | ||
color: var(--color-primary-base); | ||
&:hover, | ||
&:focus { | ||
color: var(--color-primary-darker); | ||
} | ||
} | ||
&-black:not(&-disabled) { | ||
color: var(--color-text-strong-950); | ||
&:hover, | ||
&:focus { | ||
color: var(--color-text-strong-950); | ||
} | ||
} | ||
&-gray:not(&-disabled) { | ||
color: var(--color-text-sub-600); | ||
&:hover, | ||
&:focus { | ||
color: var(--color-text-sub-600); | ||
} | ||
} | ||
&-error:not(&-disabled) { | ||
color: var(--color-state-error-base); | ||
&:hover, | ||
&:focus { | ||
color: var(--color-red-700); | ||
} | ||
} | ||
} | ||
</style> |
26 changes: 26 additions & 0 deletions
26
packages/celeste-vue/src/components/button/stories/link-button.stories.ts
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,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3'; | ||
import LinkButton from '../link-button.vue'; | ||
|
||
const meta: Meta<typeof LinkButton> = { | ||
title: 'Components/LinkButton', | ||
component: LinkButton, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof LinkButton>; | ||
|
||
export const Default: Story = { | ||
render: args => ({ | ||
components: { LinkButton }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: ` | ||
<LinkButton target="self" href="https://google.com" v-bind="args"> | ||
Link Button Text | ||
<i i-celeste-arrow-right-s-line /> | ||
</LinkButton> | ||
`, | ||
}), | ||
}; |
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,2 @@ | ||
export * from './alert'; | ||
export * from './button'; |
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,3 +1,15 @@ | ||
import type { App } from 'vue'; | ||
import * as components from '@/components'; | ||
import 'virtual:uno.css'; | ||
|
||
export * from '@/components/alert'; | ||
const Celeste = { | ||
install(vue: App) { | ||
Object.entries(components).forEach(([name, component]) => { | ||
vue.component(name, component); | ||
}); | ||
}, | ||
}; | ||
|
||
export * from '@/components'; | ||
|
||
export default Celeste; |
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
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