Svelte being one of the modern frameworks that I have hooked the most, and seeing no ongoing projects for social buttons, needing them personally, I set out to create what I needed, and at the same time share this work with other developers. Many projects have inspired me, in particular Svelma, a library of components with the "Bulma" css framework.
All my sources are available in the components in question.
I hate librairies with a lot of dependencies, so I did a librairy with just oaun
(to make the oauth system) as dependency.
NPM:
npm install -D svecial
YARN:
yarn install -D svecial
Import components like:
import { GoogleButton } from 'svecial'
A lot of buttons depend of Bulma's framework and Font Awesome. Think to add them if you want to enjoy more this librairy!
Each component/button has:
appId
: It's here where you must to put the id of the app that you created. If the component doesn't appear, it's probably because this props is missing.onLoginSuccess
: It's a callback if the user has been logged with success. It will return you the response of the api as parameter (depending of which button you use, Svecial can't predict informations about it).onLoginFailure
: It's a callback if the user has been logged with failure. It will return you the response of the api as parameter (generally the error).Depending of which button, props are different. If we can customize easily the button, you should use color
as props, else it should be theme
...
More informations about the api here: https://olyno.github.io/svecial/
Svecial
supports SSR. If you get any error when compiling, please compare your rollup.config.js
file with Svecial doc's config.
Special thanks to @matyunya for taking his time to help Svecial create the SSR part
Here is a plan of what Svecial should contain:
onLoginSuccess
or onLoginError
but that's all. You're not supposed to make your backend directly on the component, but include the composent to your backend.git clone https://github.com/Olyno/svecial.git
npm i
or yarn
npm run dev
or yarn dev
tests/stories
dir. Please think to create tests in the tests/specs
dir.The build is not automatically. When you create a new component, do npm run build
or yarn build
.
When you think you can deploy your code, just to npm run deploy
or yarn deploy
.
Code released under GNU license.
Copyright ©, Olyno.