-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
205 changed files
with
6,119 additions
and
3,677 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.17.1 | ||
0.18.0 |
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 |
---|---|---|
@@ -1,7 +1,17 @@ | ||
module.exports = { | ||
presets: [ | ||
'vca-jsx', | ||
'@vue/cli-plugin-babel/preset', | ||
'@vue/babel-preset-app', | ||
'@babel/preset-typescript', | ||
], | ||
overrides: [ | ||
{ | ||
include: './**/*.tsx', | ||
presets: [ | ||
['@vue/babel-preset-app', { jsx: false }], | ||
['@babel/preset-react', { runtime: 'automatic' }], | ||
'@babel/preset-typescript', | ||
], | ||
}, | ||
], | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@use '~@/style/globals'; | ||
@use 'sass:color'; | ||
|
||
/// Marge entre l'icône et le texte des boutons (quand il y en a une, d'icône) | ||
/// @type Number | ||
$icon-margin: 0.3571rem !default; | ||
|
||
// | ||
// - Default variant | ||
// | ||
|
||
$default-color: globals.$color-base-button !default; | ||
$default-background: globals.$bg-color-button-default !default; | ||
|
||
$default-focused-color: color.adjust(globals.$bg-color-button-default, $lightness: 8%) !default; | ||
$default-focused-background: globals.$color-hover-button !default; | ||
|
||
$default-active-color: color.adjust(globals.$bg-color-button-default, $lightness: -8%) !default; | ||
$default-active-background: globals.$color-active-button !default; | ||
|
||
// | ||
// - Primary variant | ||
// | ||
|
||
$primary-variant-color: #fff !default; | ||
$primary-variant-background: #c35022 !default; | ||
|
||
$primary-variant-focused-color: $primary-variant-color !default; | ||
$primary-variant-focused-background: color.adjust(#e14407, $lightness: 5%) !default; | ||
|
||
$primary-variant-active-color: $primary-variant-color !default; | ||
$primary-variant-active-background: color.adjust(#e14407, $lightness: -5%) !default; | ||
|
||
// | ||
// - Success variant | ||
// | ||
|
||
$success-variant-color: #fff !default; | ||
$success-variant-background: globals.$bg-color-button-success !default; | ||
|
||
$success-variant-focused-color: $success-variant-color !default; | ||
$success-variant-focused-background: color.adjust(globals.$bg-color-button-success, $lightness: 5%) !default; | ||
|
||
$success-variant-active-color: globals.$color-active-button !default; | ||
$success-variant-active-background: color.adjust(globals.$bg-color-button-success, $lightness: -5%) !default; | ||
|
||
// | ||
// - Warning variant | ||
// | ||
|
||
$warning-variant-color: #fff !default; | ||
$warning-variant-background: #be692d !default; | ||
|
||
$warning-variant-focused-color: $warning-variant-color !default; | ||
$warning-variant-focused-background: color.adjust(#be692d, $lightness: 8%) !default; | ||
|
||
$warning-variant-active-color: globals.$color-active-button !default; | ||
$warning-variant-active-background: color.adjust(#be692d, $lightness: 8%) !default; | ||
|
||
// | ||
// - Danger variant | ||
// | ||
|
||
$danger-variant-color: #fff !default; | ||
$danger-variant-background: globals.$bg-color-button-danger !default; | ||
|
||
$danger-variant-focused-color: $danger-variant-color !default; | ||
$danger-variant-focused-background: color.adjust(globals.$bg-color-button-danger, $lightness: 8%) !default; | ||
|
||
$danger-variant-active-color: globals.$color-active-button !default; | ||
$danger-variant-active-background: color.adjust(globals.$bg-color-button-danger, $lightness: -8%) !default; |
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,97 @@ | ||
import './index.scss'; | ||
import { toRefs, computed } from '@vue/composition-api'; | ||
import { Fragment } from 'vue-fragment'; | ||
import Icon from '@/components/Icon'; | ||
|
||
const BUTTON_TYPE = ['default', 'success', 'warning', 'danger', 'primary']; | ||
|
||
// @vue/component | ||
const Button = (props, { slots, emit }) => { | ||
const { htmlType, icon, disabled, type, to, loading } = toRefs(props); | ||
const _icon = computed(() => { | ||
if (!icon.value) { | ||
return null; | ||
} | ||
|
||
if (loading.value) { | ||
return { name: 'spinner', spin: true }; | ||
} | ||
|
||
if (!icon.value.includes(':')) { | ||
return { name: icon.value }; | ||
} | ||
|
||
const [iconType, variant] = icon.value.split(':'); | ||
return { name: iconType, variant }; | ||
}); | ||
|
||
const _className = computed(() => [ | ||
'Button', | ||
`Button--${type.value}`, { | ||
'Button--disabled': disabled.value || loading.value, | ||
'Button--loading': loading.value, | ||
'Button--with-icon': !!_icon, | ||
}, | ||
]); | ||
|
||
return () => { | ||
const children = slots.default?.(); | ||
|
||
const content = ( | ||
<Fragment> | ||
{_icon.value && <Icon {...{ props: _icon.value }} class="Button__icon" />} | ||
{children && <span class="Button__content">{children}</span>} | ||
</Fragment> | ||
); | ||
|
||
if (to.value && !disabled.value) { | ||
return ( | ||
<router-link to={to.value} custom> | ||
{({ href, navigate: handleClick }) => ( | ||
<a href={href} onClick={handleClick} class={_className.value}> | ||
{content} | ||
</a> | ||
)} | ||
</router-link> | ||
); | ||
} | ||
|
||
return ( | ||
<button | ||
// eslint-disable-next-line react/button-has-type | ||
type={htmlType.value} | ||
class={_className.value} | ||
disabled={disabled.value || loading.value} | ||
onClick={emit.bind(null, 'click')} | ||
> | ||
{content} | ||
</button> | ||
); | ||
}; | ||
}; | ||
|
||
Button.props = { | ||
htmlType: { | ||
default: 'button', | ||
validator: (value) => ( | ||
typeof value === 'string' && | ||
['button', 'submit', 'reset'].includes(value) | ||
), | ||
}, | ||
type: { | ||
type: String, | ||
validator: (value) => BUTTON_TYPE.includes(value), | ||
default: 'default', | ||
}, | ||
to: { | ||
type: [String, Object], | ||
default: undefined, | ||
}, | ||
icon: { type: String, default: undefined }, | ||
loading: { type: Boolean, default: false }, | ||
disabled: { type: Boolean, default: false }, | ||
}; | ||
|
||
Button.emits = ['click']; | ||
|
||
export default Button; |
Oops, something went wrong.