Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b513312
add button
lux-v Aug 12, 2025
eda6b3c
add button enums
lux-v Aug 12, 2025
c14365d
fix typo
lux-v Aug 13, 2025
08ec3f2
fix typo
lux-v Aug 13, 2025
6925708
Merge branch 'main' of https://github.com/funkhaus/ucla-library-websi…
lux-v Aug 15, 2025
84598a9
Update _button.scss
lux-v Aug 15, 2025
631c85b
adjust style import for Button.vue
lux-v Aug 15, 2025
cf50b59
Merge branch 'main' of https://github.com/lux-v/ucla-library-website-…
lux-v Sep 3, 2025
9dd8a0e
add lint fix
lux-v Sep 3, 2025
51ec7d5
add dlc theme
lux-v Sep 3, 2025
1a1c7ff
add packageManager for our storybook
lux-v Sep 3, 2025
6c2b67b
add package manager to root package
lux-v Sep 3, 2025
7b94cc0
Merge branch 'main' of https://github.com/funkhaus/ucla-library-websi…
lux-v Oct 28, 2025
3ce3ab1
remove packageManager
lux-v Oct 28, 2025
9866fdb
dummy
lux-v Oct 28, 2025
04f3b95
Merge branch 'main' of https://github.com/funkhaus/ucla-library-websi…
lux-v Nov 3, 2025
242f9b2
Merge branch 'main' of https://github.com/funkhaus/ucla-library-websi…
lux-v Nov 11, 2025
93ae545
fix: remove old button
lux-v Nov 11, 2025
ad0be97
feat: add DLC for button-link
lux-v Nov 11, 2025
ae8d8f6
feat: lint fix
lux-v Nov 11, 2025
cf1eaba
feat: adjust min height for button secondary
lux-v Nov 11, 2025
ec0a318
fix: font-weight for DLC theme
lux-v Nov 11, 2025
b91e46c
Merge branch 'main' into button
pghorpade Nov 12, 2025
694d272
Merge branch 'main' of https://github.com/funkhaus/ucla-library-websi…
lux-v Nov 13, 2025
d6becfc
Delete NOTES.md
lux-v Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions packages/vue-component-library/src/lib-components/Button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup lang="ts">
import { computed } from "vue"
import type { ButtonProps } from "@/types/components/button.types"
import { ButtonColor, ButtonVariant } from "@/types/components/button.types"
import SmartLink from "./SmartLink.vue"

// Props
const props = withDefaults(defineProps<ButtonProps>(), {
variant: ButtonVariant.Primary,
color: ButtonColor.Default,
type: "button",
isDisabled: false,
isOutlined: false,
isGrey: false,

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop isGrey is defined in the defaults but doesn't exist in the ButtonProps interface. This will cause a TypeScript error and the prop is unused in the component.

Suggested change
isGrey: false,

Copilot uses AI. Check for mistakes.
linkTarget: "",
isDownload: false,
})

// Emits
const emit = defineEmits<{
click: [event: MouseEvent]
}>()

// Computeds
const classes = computed(() => [
"button",
props.variant,
props.color ? `color-${props.color}` : "",
{ "is-outlined": props.isOutlined },
{ "is-disabled": props.isDisabled },
])

// Methods
function handleClick(event: MouseEvent) {
if (!props.isDisabled) emit("click", event)
}
</script>

<template>
<SmartLink
v-if="to"
:class="classes"
:to="to"
:link-target="linkTarget"
:is-download="isDownload"
>
{{ text }}
</SmartLink>

<button
v-else
:class="classes"
:type="type"
:disabled="isDisabled"
@click="handleClick"
>
{{ text }}
</button>
</template>

<style lang="scss" scoped>
@import "../styles/default/_button.scss";
</style>
149 changes: 149 additions & 0 deletions packages/vue-component-library/src/stories/Button.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import Button from "@/lib-components/Button.vue"
import { ButtonColor, ButtonVariant } from "@/types/components/button.types"

// Storybook default settings
export default {
title: "Funkhaus / Button",
component: Button,
argTypes: {
text: { control: "text" },
to: { control: "text" },
variant: {
control: "select",
options: ["primary", "secondary"],
},
type: {
control: "select",
options: ["button", "submit", "reset"],
},
isDisabled: { control: "boolean" },
isOutlined: { control: "boolean" },
linkTarget: { control: "text" },
isDownload: { control: "boolean" },
click: { action: "clicked" },
},
decorators: [
() => ({
template: "<story />",
}),
],
}

function Template(args) {
return {
setup() {
return { args }
},
components: { Button },
template: '<Button v-bind="args" @click="args.click" />',
}
}

// Default stories
export const Primary = Template.bind({})
Primary.args = {
text: "Primary Button",
onClick: () => {
alert("Primary Button Clicked!")
},
}

export const PrimaryOutlined = Template.bind({})
PrimaryOutlined.args = {
text: "Primary Outlined Button",
isOutlined: true,
onClick: () => {
alert("Primary Button Clicked!")
},
}

export const PrimaryDisabled = Template.bind({})
PrimaryDisabled.args = {
text: "Primary Disabled Button",
isDisabled: true,
onClick: () => {
alert("Primary Button Clicked!")
},
}

export const PrimaryGray = Template.bind({})
PrimaryGray.args = {
text: "Primary Gray Button",
color: ButtonColor.Grey,
onClick: () => {
alert("Primary Button Clicked!")
},
}

export const PrimaryOutlinedGray = Template.bind({})
PrimaryOutlinedGray.args = {
text: "Primary Outlined Gray Button",
isOutlined: true,
color: ButtonColor.Grey,
onClick: () => {
alert("Primary Button Clicked!")
},
}

export const PrimaryLink = Template.bind({})
PrimaryLink.args = {
text: "External Link Button",
to: "https://www.google.com",
}

export const Secondary = Template.bind({})
Secondary.args = {
text: "Secondary Button",
variant: ButtonVariant.Secondary,
onClick: () => {
alert("Secondray Button Clicked!")

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in alert message: "Secondray" should be "Secondary".

Suggested change
alert("Secondray Button Clicked!")
alert("Secondary Button Clicked!")

Copilot uses AI. Check for mistakes.
},
}

export const SecondaryOutlined = Template.bind({})
SecondaryOutlined.args = {
text: "Secondary Outlined Button",
variant: ButtonVariant.Secondary,
isOutlined: true,
onClick: () => {
alert("Secondray Button Clicked!")

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in alert message: "Secondray" should be "Secondary".

Suggested change
alert("Secondray Button Clicked!")
alert("Secondary Button Clicked!")

Copilot uses AI. Check for mistakes.
},
}

export const SecondaryGray = Template.bind({})
SecondaryGray.args = {
text: "Secondary Gray Button",
variant: ButtonVariant.Secondary,
color: ButtonColor.Grey,
onClick: () => {
alert("Secondray Button Clicked!")

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in alert message: "Secondray" should be "Secondary".

Suggested change
alert("Secondray Button Clicked!")
alert("Secondary Button Clicked!")

Copilot uses AI. Check for mistakes.
},
}

export const SecondaryOutlinedGray = Template.bind({})
SecondaryOutlinedGray.args = {
text: "Secondary Outlined Gray Button",
variant: ButtonVariant.Secondary,
isOutlined: true,
color: ButtonColor.Grey,
onClick: () => {
alert("Secondray Button Clicked!")

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in alert message: "Secondray" should be "Secondary".

Suggested change
alert("Secondray Button Clicked!")
alert("Secondary Button Clicked!")

Copilot uses AI. Check for mistakes.
},
}

export const SecondaryDisabled = Template.bind({})
SecondaryDisabled.args = {
text: "Secondary Disabled Button",
variant: ButtonVariant.Secondary,
isDisabled: true,
onClick: () => {
alert("Secondray Button Clicked!")

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in alert message: "Secondray" should be "Secondary".

Suggested change
alert("Secondray Button Clicked!")
alert("Secondary Button Clicked!")

Copilot uses AI. Check for mistakes.
},
}

export const SecondaryLink = Template.bind({})
SecondaryLink.args = {
text: "External Link Button",
variant: ButtonVariant.Secondary,
to: "https://www.google.com",
}
117 changes: 117 additions & 0 deletions packages/vue-component-library/src/styles/default/_button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.button {
--transition-duration: 0.3s;

display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;

transition: background-color var(--transition-duration),
color var(--transition-duration),
border-color var(--transition-duration);

// Primary variant
&.primary {
padding: 10px 15px;
border-radius: 30px;
background-color: var(--color-secondary-blue-01);

font-size: 18px;
font-family: var(--font-secondary);
font-weight: 400;
line-height: 1;
color: var(--color-white);

&.is-outlined {
padding-block: 9px;
background-color: transparent;
border: 1px solid var(--color-secondary-blue-01);
color: var(--color-secondary-blue-01);
}
}

// Secondary variant
&.secondary {
padding: 9px 20px;
border-radius: 5px;
background-color: $accent-blue;

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent use of SCSS variables vs CSS custom properties. Line 37 uses $accent-blue while other lines use CSS custom properties like var(--color-secondary-blue-01). Consider using CSS custom properties consistently for better maintainability.

Suggested change
background-color: $accent-blue;
background-color: var(--color-secondary-blue-01);

Copilot uses AI. Check for mistakes.

font-size: 18px;
font-family: var(--font-primary);
font-weight: 600;
line-height: 1;
color: var(--color-white);

&.is-outlined {
padding-block: 8px;
background-color: transparent;
border: 1px solid var(--color-secondary-blue-01);
color: var(--color-secondary-blue-01);
}
}

// When disabled
&.is-disabled {
opacity: 0.6;
cursor: not-allowed;
pointer-events: none;
}

&.color-grey {
background-color: $subtitle-grey;
color: var(--color-white);

&.is-outlined {
background-color: transparent;
border: 1px solid $subtitle-grey;
color: $subtitle-grey;

Copilot AI Aug 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent use of SCSS variables vs CSS custom properties. Line 61 uses $subtitle-grey while other lines use CSS custom properties. Consider using CSS custom properties consistently.

Suggested change
color: $subtitle-grey;
background-color: var(--color-subtitle-grey);
color: var(--color-white);
&.is-outlined {
background-color: transparent;
border: 1px solid var(--color-subtitle-grey);
color: var(--color-subtitle-grey);

Copilot uses AI. Check for mistakes.
}
}

// Hovers
@media #{$has-hover} {
&:hover:not(.is-disabled) {
background-color: var(--color-primary-blue-05);

&.is-outlined {
background-color: var(--color-secondary-blue-01);
border-color: var(--color-secondary-blue-01);
color: var(--color-white);
}

&.color-grey {
background-color: var(--color-secondary-blue-01);
color: var(--color-white);

&.is-outlined {
background-color: var(--color-secondary-blue-01);
border-color: var(--color-secondary-blue-01);
color: var(--color-white);
}
}

// Secondary variant
&.secondary {
background-color: var(--color-primary-blue-05);

&.is-outlined {
background-color: $accent-blue;
border-color: $accent-blue;
color: var(--color-white);
}

// Grey variant
&.color-grey {
background-color: $accent-blue;
color: var(--color-white);

&.is-outlined {
background-color: $accent-blue;
border-color: $accent-blue;
color: var(--color-white);
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Button component types
export enum ButtonVariant {
Primary = "primary",
Secondary = "secondary",
}

export enum ButtonColor {
Default = "default",
Grey = "grey",
}

export interface ButtonProps {
text: string
to?: string
variant?: ButtonVariant
type?: "button" | "submit" | "reset"
isOutlined?: boolean
isDisabled?: boolean
color?: ButtonColor
linkTarget?: string
isDownload?: boolean
}