-
-
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.
Ajoute la prise en charge React + Bridge Vue lié (#325)
* Logo component refactoring * Supprime TypeScript pour les components Vue 😢 * Supprime les définitions globales pour les types Vue * Little refactoring * Suite de la suppression du TypeScript dans les fichiers Js liés à Vue * Ajoute la prise en charge de React * Corrige le code suite à la mise à jour de la config. de Linting * Convertit le component Logo vers un component React
- Loading branch information
Showing
51 changed files
with
837 additions
and
907 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import './index.scss'; | ||
import { toRefs, computed } from '@vue/composition-api'; | ||
import Icon from '@/components/Icon'; | ||
|
||
// type Props = { | ||
// /** | ||
// * Le type de bouton pour l'attribut `type` de la balise `<button>`? | ||
// * | ||
// * Options disponibles: `submit`, `button` ou `reset`. | ||
// */ | ||
// htmlType?: 'submit' | 'button' | 'reset', | ||
|
||
// /** | ||
// * Le code de l'éventuelle icône qui sera ajoutée au bouton. | ||
// * | ||
// * Pour utiliser une variante de l'icône, vous pouvez suffixer le nom de l'icône avec `:[variante]`. | ||
// * Par exemple: `plus:solid` ou `birthday-cake:regular`. | ||
// * | ||
// * Voir le component <Icon> concernant la liste des codes et les variantes possibles. | ||
// */ | ||
// icon?: string | undefined, | ||
|
||
// /** Le bouton est-il désactivé ? */ | ||
// disabled?: boolean, | ||
|
||
// /** Des éventuelles classes supplémentaires qui seront ajoutées au component. */ | ||
// class?: string, | ||
// }; | ||
|
||
// @vue/component | ||
const Button = (props, { slots }) => { | ||
const { htmlType, icon, disabled } = toRefs(props); | ||
const _icon = computed(() => { | ||
if (!icon.value) { | ||
return null; | ||
} | ||
|
||
if (!icon.value.includes(':')) { | ||
return { name: icon.value }; | ||
} | ||
|
||
const [iconType, variant] = icon.value.split(':'); | ||
return { name: iconType, variant }; | ||
}); | ||
|
||
const _className = ['Button', { | ||
'Button--with-icon': !!_icon, | ||
}]; | ||
|
||
return () => { | ||
const children = slots.default?.(); | ||
|
||
return ( | ||
// eslint-disable-next-line react/button-has-type | ||
<button type={htmlType.value} class={_className} disabled={disabled.value}> | ||
{_icon.value && <Icon {...{ props: _icon.value }} class="Button__icon" />} | ||
{children && <span class="Button__content">{children}</span>} | ||
</button> | ||
); | ||
}; | ||
}; | ||
|
||
Button.props = { | ||
htmlType: { | ||
default: 'button', | ||
validator: (value) => ( | ||
typeof value === 'string' && | ||
['button', 'submit', 'reset'].includes(value) | ||
), | ||
}, | ||
icon: { type: String, default: undefined }, | ||
disabled: { type: Boolean, default: false }, | ||
}; | ||
|
||
export default Button; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.