diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7124406e..382dd55b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,5 +154,7 @@ jobs: run: cd ../../ && yarn - name: Build rescript in squiggle-lang run: cd ../squiggle-lang && yarn build + - name: Build components + run: cd ../components && yarn build - name: Build website assets run: yarn build diff --git a/packages/components/package.json b/packages/components/package.json index 1cb55141..b5cdec3c 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -42,6 +42,8 @@ "@types/styled-components": "^5.1.24", "@types/webpack": "^5.28.0", "cross-env": "^7.0.3", + "mini-css-extract-plugin": "^2.6.0", + "postcss-loader": "^7.0.0", "react-scripts": "^5.0.1", "style-loader": "^3.3.1", "tailwindcss": "^3.0.24", @@ -55,7 +57,7 @@ }, "scripts": { "start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public", - "build": "tsc -b && build-storybook -s public", + "build": "tsc -b && tailwindcss -i ./src/tailwind.css -o ./dist/main.css && build-storybook -s public", "bundle": "webpack", "all": "yarn bundle && yarn build", "lint": "prettier --check .", diff --git a/packages/components/postcss.config.js b/packages/components/postcss.config.js new file mode 100644 index 00000000..3691aac9 --- /dev/null +++ b/packages/components/postcss.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + cssnano: {}, + }, +}; diff --git a/packages/components/src/components/Alert.tsx b/packages/components/src/components/Alert.tsx index 4e1dc646..590b1cca 100644 --- a/packages/components/src/components/Alert.tsx +++ b/packages/components/src/components/Alert.tsx @@ -10,23 +10,32 @@ export const Alert: React.FC<{ backgroundColor: string; headingColor: string; bodyColor: string; - icon: React.ReactNode; - children: React.ReactNode; + icon: (props: React.ComponentProps<"svg">) => JSX.Element; + iconColor: string; + children?: React.ReactNode; }> = ({ heading = "Error", backgroundColor, headingColor, bodyColor, - icon, + icon: Icon, + iconColor, children, }) => { return (
-
{icon}
+
@@ -35,49 +44,42 @@ export const Alert: React.FC<{ export const ErrorAlert: React.FC<{ heading: string; - children: React.ReactNode; -}> = ({ heading = "Error", children }) => ( + children?: React.ReactNode; +}> = (props) => (