Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
feat: change css to css-in-js
Browse files Browse the repository at this point in the history
  • Loading branch information
xxholly32 committed Dec 2, 2020
1 parent 6650e52 commit ca12693
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 4 deletions.
3 changes: 0 additions & 3 deletions packages/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ export default defineComponent({
},
});
</script>
<style lang="css">
@import url("./style/main.css");
</style>
69 changes: 69 additions & 0 deletions packages/Button/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// tailwind.config.js
const plugin = require("tailwindcss/plugin");

// https://github.com/tailwindlabs/tailwindcss/blob/v1/stubs/defaultConfig.stub.js
module.exports = plugin(function ({ addComponents, config }) {
const buttons = {
".btn": {
borderWidth: config("theme.borderWidth.default"),
paddingBottom: config("theme.padding.2"),
paddingTop: config("theme.padding.2"),
paddingRight: config("theme.padding.4"),
paddingLeft: config("theme.padding.4"),
borderRadius: config("theme.borderRadius.default"),
},
".btn + .btn": {
marginLeft: "10px",
},
".btn-primary": {
backgroundColor: config("theme.colors.blue.500"),
borderColor: config("theme.colors.blue.500"),
color: config("theme.colors.white"),
},
".btn-primary:hover": {
backgroundColor: config("theme.colors.blue.700"),
borderColor: config("theme.colors.blue.700"),
},
".btn-success": {
backgroundColor: config("theme.colors.green.400"),
borderColor: config("theme.colors.green.400"),
color: config("theme.colors.white"),
},
".btn-success:hover": {
backgroundColor: config("theme.colors.green.500"),
borderColor: config("theme.colors.green.500"),
},

".btn-info": {
backgroundColor: config("theme.colors.gray.400"),
borderColor: config("theme.colors.gray.400"),
color: config("theme.colors.white"),
},
".btn-info:hover": {
backgroundColor: config("theme.colors.gray.500"),
borderColor: config("theme.colors.gray.500"),
},

".btn-warning": {
backgroundColor: config("theme.colors.yellow.400"),
borderColor: config("theme.colors.yellow.400"),
color: config("theme.colors.white"),
},
".btn-warning:hover": {
backgroundColor: config("theme.colors.yellow.500"),
borderColor: config("theme.colors.yellow.500"),
},

".btn-danger": {
backgroundColor: config("theme.colors.red.400"),
borderColor: config("theme.colors.red.400"),
color: config("theme.colors.white"),
},
".btn-danger:hover": {
backgroundColor: config("theme.colors.red.500"),
borderColor: config("theme.colors.red.500"),
},
};

addComponents(buttons);
});
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
plugins: [
require('@tailwindcss/typography')
require('@tailwindcss/typography'),
require("./packages/Button/style/index")
],
}

0 comments on commit ca12693

Please sign in to comment.