Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation bouton #22

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 9 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 1 addition & 78 deletions src/assets/base.css
Original file line number Diff line number Diff line change
@@ -1,55 +1,3 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;

--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;

--vt-c-indigo: #2c3e50;

--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);

--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}

/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);

--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);

--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);

--section-gap: 160px;
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);

--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);

--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}

*,
*::before,
*::after {
Expand All @@ -58,29 +6,4 @@
font-weight: normal;
}

body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition:
color 0.5s,
background-color 0.5s;
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

Binary file added src/assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Regular.ttf
Binary file not shown.
38 changes: 9 additions & 29 deletions src/assets/main.css
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
@import './base.css';
@import '../tokens/colors.css';

#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
font-weight: normal;
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
font-display: fallback;
src: url("fonts/Roboto-Regular.ttf") format("ttf");
}

a,
.green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
padding: 3px;
}

@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}

@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
:root{
font-family: "Roboto";

#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}
16 changes: 12 additions & 4 deletions src/stories/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ const meta = {
tags: ['autodocs'],
argTypes: {
size: { control: 'select', options: ['small', 'medium', 'large'] },
backgroundColor: { control: 'color' },
type: { options: ['primary', 'secondary', 'destructive'] },
},
args: {
primary: false,
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
onClick: fn(),
},
Expand All @@ -28,18 +27,26 @@ type Story = StoryObj<typeof meta>;
*/
export const Primary: Story = {
args: {
primary: true,
type: 'primary',
label: 'Button',
},
};

export const Secondary: Story = {
args: {
primary: false,
type: 'secondary',
label: 'Button',
},
};

export const Destructive: Story = {
args: {
type: 'destructive',
label: 'Button',
},
};


export const Large: Story = {
args: {
label: 'Button',
Expand All @@ -53,3 +60,4 @@ export const Small: Story = {
size: 'small',
},
};

68 changes: 17 additions & 51 deletions src/stories/Button.vue
Original file line number Diff line number Diff line change
@@ -1,84 +1,50 @@
<template>
<button type="button" :class="classes" @click="onClick" :style="style">{{ label }} </button>
<button type="button" :class="classes" @click="onClick" >{{ label }} </button>
</template>

<script lang="ts" setup>

import { computed } from 'vue';
import "@/tokens/colors.css";
import "@/stories/button.css"


const props = withDefaults(defineProps<{
type ButtonProps = {
/**
* The label of the button
*/
label: string,
/**
* primary or secondary button
* Button type
*/
primary?: boolean,
type?: 'primary'| 'secondary' | 'destructive',

/**
* size of the button
*/
size?: 'small' | 'medium' | 'large',
/**
* background color of the button
*/
backgroundColor?: string,

}>(), { primary: false });
}

const props = withDefaults(defineProps<ButtonProps>(), {
type:'primary',
size:'medium',
});

const emit = defineEmits<{
(e: 'click', id: number): void;
}>();

const classes = computed(() => ({
'storybook-button': true,
'storybook-button--primary': props.primary,
'storybook-button--secondary': !props.primary,
[`storybook-button--${props.type || 'primary'}`]: true,
[`storybook-button--${props.size || 'medium'}`]: true,
}));

const style = computed(() => ({
backgroundColor: props.backgroundColor
}));

const onClick = () => {
emit("click", 1)
};

</script>
<style src="src/assets/main.css" lang="css"/>

<style scoped>
button {
color: red;
}
.storybook-button {
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 700;
border: 0;
border-radius: 3em;
cursor: pointer;
display: inline-block;
line-height: 1;
}
.storybook-button--primary {
color: white;
background-color: #1ea7fd;
}
.storybook-button--secondary {
color: #333;
background-color: transparent;
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
}
.storybook-button--small {
font-size: 12px;
padding: 10px 16px;
}
.storybook-button--medium {
font-size: 14px;
padding: 11px 20px;
}
.storybook-button--large {
font-size: 16px;
padding: 12px 24px;
}

</style>
Loading