From 4e1b5cfc895117348c940b6afe8b2817d033b25f Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 19 Jan 2018 07:17:07 +0200 Subject: [PATCH] Components and loaders. --- client/package.json | 4 +- client/src/index.js | 9 +- .../src/modules/ui/components/bdsettings.vue | 39 +++- .../modules/ui/components/sidebar/Button.vue | 39 ++++ .../modules/ui/components/sidebar/Header.vue | 26 +++ .../modules/ui/components/sidebar/Item.vue | 17 ++ .../modules/ui/components/sidebar/Sidebar.vue | 32 +++ .../modules/ui/components/sidebar/View.vue | 192 ++++++++++++++++++ .../modules/ui/components/sidebar/index.js | 5 + client/src/styles/index.scss | 0 client/webpack.config.js | 8 +- 11 files changed, 367 insertions(+), 4 deletions(-) create mode 100644 client/src/modules/ui/components/sidebar/Button.vue create mode 100644 client/src/modules/ui/components/sidebar/Header.vue create mode 100644 client/src/modules/ui/components/sidebar/Item.vue create mode 100644 client/src/modules/ui/components/sidebar/Sidebar.vue create mode 100644 client/src/modules/ui/components/sidebar/View.vue create mode 100644 client/src/modules/ui/components/sidebar/index.js create mode 100644 client/src/styles/index.scss diff --git a/client/package.json b/client/package.json index 516d7d2c..eec6e72d 100644 --- a/client/package.json +++ b/client/package.json @@ -26,7 +26,9 @@ "vue": "^2.5.13", "vue-loader": "^13.7.0", "vue-template-compiler": "^2.5.13", - "css-loader": "^0.28.9" + "css-loader": "^0.28.9", + "sass-loader": "^6.0.6", + "node-sass": "^4.7.2" }, "scripts": { "build": "webpack --progress --colors", diff --git a/client/src/index.js b/client/src/index.js index 3c8c1ac6..82684eb3 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -10,6 +10,7 @@ 'use strict'; +const styles = require('./styles/index.scss'); const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Events } = require('./modules'); //const { UI } = require('./modules/ui/index.jsx'); @@ -22,7 +23,13 @@ class BetterDiscord { const { UI } = require('./modules/ui/vueui.js'); this.ui = new UI(); }); - // this.UI = new UI(); + + //Inject styles to head for now + const style = document.createElement('style'); + style.id = 'bd-main'; + style.type = 'text/css'; + style.appendChild(document.createTextNode(styles)); + document.head.appendChild(style); } } diff --git a/client/src/modules/ui/components/bdsettings.vue b/client/src/modules/ui/components/bdsettings.vue index 0a29e93a..b6f03e24 100644 --- a/client/src/modules/ui/components/bdsettings.vue +++ b/client/src/modules/ui/components/bdsettings.vue @@ -1,11 +1,48 @@ diff --git a/client/src/modules/ui/components/sidebar/Button.vue b/client/src/modules/ui/components/sidebar/Button.vue new file mode 100644 index 00000000..4e90f853 --- /dev/null +++ b/client/src/modules/ui/components/sidebar/Button.vue @@ -0,0 +1,39 @@ + + + \ No newline at end of file diff --git a/client/src/modules/ui/components/sidebar/Header.vue b/client/src/modules/ui/components/sidebar/Header.vue new file mode 100644 index 00000000..0739eed9 --- /dev/null +++ b/client/src/modules/ui/components/sidebar/Header.vue @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/client/src/modules/ui/components/sidebar/Item.vue b/client/src/modules/ui/components/sidebar/Item.vue new file mode 100644 index 00000000..cee026b4 --- /dev/null +++ b/client/src/modules/ui/components/sidebar/Item.vue @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/client/src/modules/ui/components/sidebar/Sidebar.vue b/client/src/modules/ui/components/sidebar/Sidebar.vue new file mode 100644 index 00000000..238e6134 --- /dev/null +++ b/client/src/modules/ui/components/sidebar/Sidebar.vue @@ -0,0 +1,32 @@ + + + + \ No newline at end of file diff --git a/client/src/modules/ui/components/sidebar/View.vue b/client/src/modules/ui/components/sidebar/View.vue new file mode 100644 index 00000000..bdbcb511 --- /dev/null +++ b/client/src/modules/ui/components/sidebar/View.vue @@ -0,0 +1,192 @@ + + + diff --git a/client/src/modules/ui/components/sidebar/index.js b/client/src/modules/ui/components/sidebar/index.js new file mode 100644 index 00000000..ff8e8a4e --- /dev/null +++ b/client/src/modules/ui/components/sidebar/index.js @@ -0,0 +1,5 @@ +export { default as SidebarHeader } from './Header.vue'; +export { default as SidebarButton } from './Button.vue'; +export { default as SidebarItem } from './Item.vue'; +export { default as SidebarView } from './View.vue'; +export { default as Sidebar } from './Sidebar.vue'; \ No newline at end of file diff --git a/client/src/styles/index.scss b/client/src/styles/index.scss new file mode 100644 index 00000000..e69de29b diff --git a/client/webpack.config.js b/client/webpack.config.js index d58dbd33..666dc045 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -17,6 +17,12 @@ const vueLoader = { loader: 'vue-loader' } +const scssLoader = { + test: /\.scss$/, + exclude: /node_modules/, + loader: ['css-loader', 'sass-loader'] +} + module.exports = { entry: './src/index.js', output: { @@ -24,7 +30,7 @@ module.exports = { filename: 'betterdiscord.client.js' }, module: { - loaders: [jsLoader, vueLoader] + loaders: [jsLoader, vueLoader, scssLoader] }, externals: { 'electron': 'window.require("electron")'