Closed akshayp660 closed 3 years ago
I have upgraded my dashboard with tailwindCSS v2. sharing few codes to fix bug's node version v14.17.3 npm version 6.14.13 package.json "scripts": { "tailwind:dev": "tailwindcss build -i src/assets/css/tailwind.css -o src/assets/css/tailwind.output.css", "tailwind:build": "cross-env NODE_ENV=production postcss src/assets/css/tailwind.css -o src/assets/css/tailwind.output.css", "prestart": "npm run tailwind:dev", "start": "react-scripts start", "prebuild": "npm run tailwind:build", "build": "react-scripts build", "cz": "git-cz", "release": "release-it", "test": "react-scripts test", "eject": "react-scripts eject" }, "dependencies": { "@hookform/resolvers": "^2.8.0", "@testing-library/jest-dom": "4.2.4", "@testing-library/react": "9.5.0", "@testing-library/user-event": "7.2.1", "@windmill/react-ui": "0.6.0", "chart.js": "^2.9.4", "classnames": "2.2.6", "faker": "4.1.0", "formik": "^2.2.9", "moment": "^2.29.1", "react": "^16.13.1", "react-chartjs-2": "2.9.0", "react-dom": "^16.13.1", "react-focus-lock": "2.4.0", "react-hook-form": "^7.12.2", "react-icons": "^4.2.0", "react-router-dom": "5.2.0", "react-scripts": "^4.0.3", "react-transition-group": "4.4.1", "yup": "^0.32.9" }, "devDependencies": { "@release-it/conventional-changelog": "^3.0.1", "@svgr/webpack": "5.4.0", "autoprefixer": "^10.3.1", "commitizen": "^4.2.4", "cross-env": "7.0.2", "cssnano": "^5.0.6", "cz-conventional-changelog": "3.2.0", "postcss-cli": "^8.3.1", "react-axe": "3.5.2", "release-it": "^14.10.0", "tailwindcss": "^2.2.4" },
tailwind.config.js
const defaultTheme = require('tailwindcss/defaultTheme') const windmill = require('@windmill/react-ui/config')
module.exports = windmill({ purge: ['src/*/.js'], theme: { extend: { fontFamily: { sans: ['Inter', ...defaultTheme.fontFamily.sans], }, boxShadow: { bottom: '0 5px 6px -7px rgba(0, 0, 0, 0.6), 0 2px 4px -5px rgba(0, 0, 0, 0.06)', }, input:{ border: '1px solid gray' } }, }, })
postcssconfig.js module.exports = { plugins: [ require('tailwindcss'), require('autoprefixer'), require('cssnano')({ preset: 'default', }), ], }
I have made some changes to the style according to my need. this file name was changed and default was myThame myStyle const myStyle = { // Alert alert: { base: 'p-4 pl-12 relative rounded-lg leading-5', withClose: 'pr-12', success: 'bg-green-50 text-green-900 dark:bg-green-600 dark:text-white', danger: 'bg-red-50 text-red-900 dark:bg-red-600 dark:text-white', warning: 'bg-yellow-50 text-yellow-900 dark:bg-yellow-600 dark:text-white', neutral: 'bg-gray-50 text-gray-800 dark:bg-gray-700 dark:text-gray-300', info: 'bg-blue-50 text-blue-900 dark:bg-blue-600 dark:text-white', icon: { base: 'h-5 w-5', success: 'text-green-400 dark:text-green-300', danger: 'text-red-400 dark:text-red-300', warning: 'text-yellow-400 dark:text-yellow-100', neutral: 'text-gray-400 dark:text-gray-500', info: 'text-blue-400 dark:text-blue-300', }, }, // Pagination pagination: { base: 'flex flex-col justify-between text-xs sm:flex-row text-gray-600 dark:text-gray-400', }, // TableFooter tableFooter: { base: 'px-4 py-3 border-t dark:border-gray-700 bg-gray-50 text-gray-500 dark:text-gray-400 dark:bg-gray-800', }, // TableRow tableRow: { base: '', }, // TableHeader tableHeader: { base: 'text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800', }, // TableContainer tableContainer: { base: 'w-full overflow-hidden rounded-lg ring-1 ring-black ring-opacity-5', }, // TableCell tableCell: { base: 'px-4 py-3', }, // TableBody tableBody: { base: 'bg-white divide-y dark:divide-gray-700 dark:bg-gray-800 text-gray-700 dark:text-gray-400', }, // DropdownItem // this is the
export default myStyle;
index.js import myStyle from './myStyle'
How can we upgrade tailwind without breaking other dependencies and functionality