├── .browserslistrc ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── oruga-tailwindcss.css │ └── tailwindcss.css ├── components │ ├── DarkModeSwitch.vue │ ├── MainHeader.vue │ ├── RecipeImage.vue │ ├── RecipeUploader.vue │ └── RecipesFinder.vue ├── main.ts ├── recipe.ts ├── router │ └── index.ts ├── shims-tsx.d.ts ├── shims-vue.d.ts └── views │ └── Home.vue ├── tailwind.config.js ├── tsconfig.json └── vue.config.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended', 9 | '@vue/typescript/recommended' 10 | ], 11 | parserOptions: { 12 | ecmaVersion: 2020 13 | }, 14 | rules: { 15 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 16 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Oruga TailwindCSS Demo 2 | 3 | This simple demo made using the upcoming [Oruga](https://github.com/oruga-ui/oruga) release shows how to customize `Oruga UI` with `TailwindCSS 2` and use components like Input, Radio, Loading, Switch, Collapse and so on! 4 | 5 | - [Online demo](https://oruga-tailwindcss-demo.netlify.app) 6 | - [Oruga Documentation preview](https://oruga-documentation-preview.netlify.app) 7 | 8 | You can find common style for Oruga UI components in `src/assets/oruga-tailwind.css` 9 | 10 | ## Project setup 11 | ``` 12 | npm install 13 | ``` 14 | 15 | ### Compiles and hot-reloads for development 16 | ``` 17 | npm run serve 18 | ``` 19 | 20 | ### Compiles and minifies for production 21 | ``` 22 | npm run build 23 | ``` 24 | 25 | ### Lints and fixes files 26 | ``` 27 | npm run lint 28 | ``` 29 | 30 | ### Customize configuration 31 | See [Configuration Reference](https://cli.vuejs.org/config/). 32 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@oruga-ui/oruga-tailwind", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@fortawesome/fontawesome-svg-core": "^1.2.29", 12 | "@fortawesome/free-brands-svg-icons": "^5.15.1", 13 | "@fortawesome/free-solid-svg-icons": "^5.13.1", 14 | "@fortawesome/vue-fontawesome": "^0.1.10", 15 | "@oruga-ui/oruga": "^0.5.5", 16 | "autoprefixer": "^9.8.6", 17 | "core-js": "^3.6.5", 18 | "postcss": "^7.0.36", 19 | "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.1", 20 | "vue": "^2.6.11", 21 | "vue-class-component": "^7.2.3", 22 | "vue-property-decorator": "^8.4.2", 23 | "vue-router": "^3.2.0", 24 | "vuex": "^3.5.1" 25 | }, 26 | "devDependencies": { 27 | "@typescript-eslint/eslint-plugin": "^2.33.0", 28 | "@typescript-eslint/parser": "^2.33.0", 29 | "@vue/cli-plugin-babel": "^4.4.0", 30 | "@vue/cli-plugin-eslint": "^4.4.0", 31 | "@vue/cli-plugin-router": "^4.4.0", 32 | "@vue/cli-plugin-typescript": "^4.4.0", 33 | "@vue/cli-service": "^4.4.0", 34 | "@vue/eslint-config-typescript": "^5.0.2", 35 | "eslint": "^6.7.2", 36 | "eslint-plugin-vue": "^6.2.2", 37 | "typescript": "~3.9.3", 38 | "vue-template-compiler": "^2.6.11" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | const autoprefixer = require('autoprefixer'); 2 | const tailwindcss = require('tailwindcss')('./tailwind.config.js'); 3 | 4 | module.exports = { 5 | plugins: [ 6 | tailwindcss, 7 | autoprefixer, 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oruga-ui/demo-tailwindcss/7e9bfa6c8ed062197a3b14c05ca44c3d9843358a/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /src/assets/oruga-tailwindcss.css: -------------------------------------------------------------------------------- 1 | /* Button */ 2 | 3 | .btn { 4 | @apply font-bold py-2 px-4 text-highlight bg-highlight-background dark:text-highlight-dark dark:bg-highlight-background-dark rounded; 5 | } 6 | 7 | 8 | /* Field */ 9 | 10 | .field-label { 11 | @apply block text-sm font-bold mb-2 text-main dark:text-main-dark; 12 | } 13 | 14 | .field-danger { 15 | @apply text-red-500; 16 | } 17 | 18 | 19 | /* Input */ 20 | 21 | .input { 22 | @apply shadow appearance-none border w-full py-2 px-3 leading-tight text-main dark:text-main-dark dark:bg-main; 23 | } 24 | 25 | .input-danger { 26 | @apply border-highlight; 27 | } 28 | 29 | 30 | /* Switch */ 31 | 32 | .switch { 33 | @apply bg-black dark:bg-highlight-dark; 34 | } 35 | 36 | .switch-label { 37 | @apply hidden; 38 | } 39 | 40 | /* Dropdown */ 41 | 42 | .dropdown-menu { 43 | @apply shadow-lg rounded-sm z-10 bg-main-dark text-main dark:text-main-dark dark:bg-main z-50 w-full; 44 | } 45 | 46 | .dropdown-item { 47 | @apply cursor-pointer text-main dark:text-main-dark dark:bg-main w-full p-1; 48 | } 49 | 50 | .dropdown-item-active { 51 | @apply text-highlight bg-highlight-background dark:text-highlight-dark dark:bg-highlight-background-dark; 52 | } 53 | 54 | 55 | /* Loading */ 56 | 57 | .loading-background { 58 | @apply bg-gray-50 dark:bg-gray-700 opacity-75; 59 | } 60 | 61 | 62 | /* Radio */ 63 | 64 | .radio { 65 | @apply font-bold py-2 px-4 rounded text-main dark:text-main-dark; 66 | min-width: 6rem; 67 | } 68 | 69 | .radio-check { 70 | @apply hidden; 71 | } 72 | 73 | .radio-checked { 74 | @apply text-highlight bg-highlight-background dark:text-highlight-dark dark:bg-highlight-background-dark; 75 | } 76 | 77 | .radio-label { 78 | @apply w-full text-center p-0; 79 | } 80 | -------------------------------------------------------------------------------- /src/assets/tailwindcss.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | body { 7 | @apply bg-white dark:bg-gray-900; 8 | } 9 | 10 | h1 { 11 | @apply text-4xl sm:text-6xl lg:text-7xl leading-none font-extrabold tracking-tight text-primary dark:text-primary-dark mt-10 mb-8 sm:mt-14 sm:mb-10; 12 | } 13 | 14 | h2 { 15 | @apply text-3xl text-primary dark:text-primary-dark; 16 | } 17 | 18 | h3 { 19 | @apply text-lg text-primary dark:text-primary-dark; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/components/DarkModeSwitch.vue: -------------------------------------------------------------------------------- 1 | 8 | 44 | -------------------------------------------------------------------------------- /src/components/MainHeader.vue: -------------------------------------------------------------------------------- 1 | 29 | -------------------------------------------------------------------------------- /src/components/RecipeImage.vue: -------------------------------------------------------------------------------- 1 | 8 | 23 | -------------------------------------------------------------------------------- /src/components/RecipeUploader.vue: -------------------------------------------------------------------------------- 1 | 141 | 218 | -------------------------------------------------------------------------------- /src/components/RecipesFinder.vue: -------------------------------------------------------------------------------- 1 | 79 | 117 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import '@oruga-ui/oruga/dist/oruga.css' 2 | 3 | import Vue from 'vue' 4 | import Vuex from 'vuex' 5 | import App from './App.vue' 6 | import router from './router' 7 | 8 | // @ts-ignore 9 | import Oruga from '@oruga-ui/oruga' 10 | 11 | import { library } from '@fortawesome/fontawesome-svg-core'; 12 | import { fas } from "@fortawesome/free-solid-svg-icons"; 13 | import { fab } from "@fortawesome/free-brands-svg-icons"; 14 | 15 | import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; 16 | 17 | import DarkModeSwitch from "./components/DarkModeSwitch.vue"; 18 | import MainHeader from "./components/MainHeader.vue"; 19 | 20 | import './assets/tailwindcss.css'; 21 | import './assets/oruga-tailwindcss.css'; 22 | 23 | Vue.config.productionTip = false 24 | 25 | library.add(fas); 26 | library.add(fab); 27 | 28 | Vue.component('vue-fontawesome', FontAwesomeIcon); 29 | Vue.component('main-header', MainHeader); 30 | 31 | Vue.filter('difficulty', (difficulty: string) => { 32 | let difficulties: any = { 33 | 'easy' : 'Easy', 34 | 'medium' : 'Medium', 35 | 'hard' : 'Hard' 36 | }; 37 | return difficulties[difficulty]; 38 | }) 39 | 40 | Vue.use(Vuex) 41 | 42 | const store = new Vuex.Store({ 43 | state: { 44 | recipes: [ 45 | { 46 | title: "Red White and Blue Rice Krispie Treats", 47 | author: "Hank Douglas", 48 | time: 20, 49 | difficulty: "medium", 50 | servings: 4, 51 | procedure: "My recipe for Red White and Blue Rice Krispie Treats lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 52 | image: "https://www.iheartnaptime.net/wp-content/uploads/2018/05/red-white-and-blue-rice-krispie-treats.jpg", 53 | isFeatured: true 54 | }, 55 | { 56 | title: "Garlic and Herb Sautéed Bell Pepper Strips", 57 | author: "Nicholas Denver", 58 | time: 30, 59 | difficulty: "easy", 60 | servings: 5, 61 | procedure: "Garlic and Herb Sautéed Bell Pepper Strips, at vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.", 62 | image: "https://www.thespruceeats.com/thmb/eFyjZT5rxTDF3j3GD2undTytLjk=/3000x3000/smart/filters:no_upscale()/garlic-herb-sauteed-bell-pepper-recipe-102112-hero-01-5be21874c9e77c0051eed106.jpg", 63 | isFeatured: true 64 | }, 65 | { 66 | title: "Lily’s Healthy Beef Burger", 67 | author: "Lily Ford", 68 | time: 10, 69 | difficulty: "easy", 70 | servings: 4, 71 | procedure: "Lily’s Healthy Beef Burger recipe, sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.", 72 | image: "https://images-na.ssl-images-amazon.com/images/I/81cMw0qNjTL._SX425_.jpg" 73 | } 74 | ], 75 | }, 76 | mutations: { 77 | addRecipe(state, recipe) { 78 | state.recipes.push(recipe) 79 | } 80 | } 81 | }) 82 | 83 | Vue.use(Oruga, { 84 | iconPack: 'fas', 85 | iconComponent: 'vue-fontawesome', 86 | statusIcon: false, 87 | button: { 88 | override: true, 89 | rootClass: 'btn', 90 | }, 91 | radio: { 92 | rootClass: 'radio', 93 | labelClass: 'radio-label', 94 | checkClass: 'radio-check', 95 | checkedClass: 'radio-checked' 96 | }, 97 | field: { 98 | override: true, 99 | labelClass: 'field-label', 100 | messageClass: 'text-xs italic', 101 | variantClass: 'field-' 102 | }, 103 | input: { 104 | override: true, 105 | inputClass: 'input focus:outline-none focus:shadow-outline', 106 | roundedClass: 'rounded', 107 | variantClass: 'input-' 108 | }, 109 | dropdown: { 110 | menuClass: 'dropdown-menu', 111 | itemClass: 'dropdown-item', 112 | itemActiveClass: 'dropdown-item-active' 113 | }, 114 | loading: { 115 | overlayClass: 'loading-background' 116 | }, 117 | icon: { 118 | override: true, 119 | spinClass: 'fa-spin' 120 | }, 121 | switch: { 122 | checkClass: 'switch', 123 | labelClass: 'switch-label', 124 | }, 125 | }) 126 | 127 | Vue.component('dark-mode-switch', DarkModeSwitch); 128 | 129 | new Vue({ 130 | router, 131 | store, 132 | render: h => h(App) 133 | }).$mount('#app') 134 | -------------------------------------------------------------------------------- /src/recipe.ts: -------------------------------------------------------------------------------- 1 | export default class Recipe { 2 | title: string = ''; 3 | author: string = ''; 4 | time: number = 0; 5 | difficulty: string = ''; 6 | servings: number = 0; 7 | procedure: string = ''; 8 | image: string = ''; 9 | isFeatured: boolean = false; 10 | } 11 | -------------------------------------------------------------------------------- /src/router/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter, { RouteConfig } from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | 5 | Vue.use(VueRouter) 6 | 7 | const routes: Array = [ 8 | { 9 | path: '/', 10 | name: 'Home', 11 | component: Home 12 | } 13 | ] 14 | 15 | const router = new VueRouter({ 16 | mode: 'history', 17 | base: process.env.BASE_URL, 18 | routes 19 | }) 20 | 21 | export default router 22 | -------------------------------------------------------------------------------- /src/shims-tsx.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue' 2 | 3 | declare global { 4 | namespace JSX { 5 | // tslint:disable no-empty-interface 6 | interface Element extends VNode {} 7 | // tslint:disable no-empty-interface 8 | interface ElementClass extends Vue {} 9 | interface IntrinsicElements { 10 | [elem: string]: any; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import Vue from 'vue' 3 | export default Vue 4 | } 5 | -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 14 | 27 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const colors = require('tailwindcss/colors') 2 | 3 | module.exports = { 4 | darkMode: 'class', 5 | theme: { 6 | extend: { 7 | colors: { 8 | main: { 9 | DEFAULT: colors.gray[700], 10 | dark: '#ffffff', 11 | }, 12 | primary: { 13 | DEFAULT: '#1fb6ff', 14 | dark: '#ffffff', 15 | }, 16 | highlight: { 17 | DEFAULT: colors.red[700], 18 | dark: colors.violet[800], 19 | }, 20 | 'highlight-background': { 21 | DEFAULT: colors.yellow[400], 22 | dark: '#1fb6ff', 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "experimentalDecorators": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "baseUrl": ".", 14 | "types": [ 15 | "webpack-env" 16 | ], 17 | "paths": { 18 | "@/*": [ 19 | "src/*" 20 | ] 21 | }, 22 | "lib": [ 23 | "esnext", 24 | "dom", 25 | "dom.iterable", 26 | "scripthost" 27 | ] 28 | }, 29 | "include": [ 30 | "src/**/*.ts", 31 | "src/**/*.tsx", 32 | "src/**/*.vue", 33 | "tests/**/*.ts", 34 | "tests/**/*.tsx" 35 | ], 36 | "exclude": [ 37 | "node_modules" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | lintOnSave: false, 4 | } --------------------------------------------------------------------------------