Skip to content

Commit

Permalink
feat(button): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Neox63 committed Jun 19, 2024
1 parent ab11cb2 commit 109428f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
29 changes: 29 additions & 0 deletions components/Molecules/Button/Button.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Button from './Button.twig';

export default {
title: 'Design System/Molecules/Button'
};

export const base = {
render: (args) => Button(args),
args: {
text: 'Button',
level: 'primary',
href: '#',
target: '_self',
type: 'button',
tag: 'button'
},

argTypes: {
text: { control: 'text' },
level: {
control: 'select',
options: ['primary', 'secondary', 'link', 'small']
},
href: { control: 'text' },
target: { control: 'select', options: ['_self', '_blank'] },
type: { control: 'select', options: ['button', 'submit', 'reset'] },
tag: { control: 'select', options: ['button', 'a'] }
}
};
19 changes: 19 additions & 0 deletions components/Molecules/Button/Button.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% set tag = tag|default('a') %}
{% set classes = 'Button' %}

{% if level is defined %}
{% set classes = classes ~ ' Button--' ~ level %}
{% endif %}

{% if class is defined %}
{% set classes = classes ~ ' ' ~ class %}
{% endif %}

<{{ tag }}
class="{{ classes }}"
{% if href is defined %}href="{{ href }}"{% endif %}
{% if target is defined %}target="{{ target }}"{% endif %}
{% if type is defined and type == 'submit' %}type="submit"{% endif %}
>
{{ text }}
</{{ tag }}>
25 changes: 25 additions & 0 deletions components/Molecules/Button/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.Button {
@apply font-medium;

&--primary {
@apply bg-vermillon-light hover:bg-vermillon-light text-gray-200 rounded-lg shadow-lg p-3;
}

&--secondary {
@apply bg-transparent hover:bg-vermillon-light border-vermillon-light border-2 text-gray-200 rounded-lg shadow-lg p-3;
}

&--link {
@apply text-vermillon-light;
}

&--small {
&-primary {
@apply bg-vermillon-light hover:bg-vermillon-light p-4 flex items-center justify-center text-gray-200 rounded-full;
}

&-secondary {
@apply flex items-center justify-center w-10 h-10 p-4 font-medium rounded-full bg-grey-medium hover:bg-charcoal-medium hover:text-grey-medium text-charcoal-medium;
}
}
}

0 comments on commit 109428f

Please sign in to comment.