Skip to content

Commit

Permalink
⚛ Preact migration + minification bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
anup-a committed Oct 13, 2020
1 parent 2392d96 commit c972d95
Show file tree
Hide file tree
Showing 17 changed files with 1,429 additions and 152,842 deletions.
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
["@babel/plugin-transform-react-jsx", { "pragma": "h" }]
]

}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "npm run watch:css && webpack-dev-server --open --hot",
"build": "npm run build:css && webpack --mode production",
"build": "npm run build:css && webpack --mode production --devtool source-map",
"build:css": "postcss src/styles/tailwind.css -o src/styles/main.css",
"watch:css": "postcss src/styles/tailwind.css -o src/styles/main.css"
"watch:css": "postcss src/styles/tailwind.css -o src/styles/main.css",
},
"keywords": [
"Svg",
Expand All @@ -20,19 +20,20 @@
"author": "Anup Aglawe",
"license": "ISC",
"dependencies": {
"react": "^16.13.1",
"preact": "^10.5.4",
"react-color": "^2.18.1",
"react-dom": "^16.13.1",
"react-toggle-dark-mode": "^1.0.2",
"save-svg-as-png": "^1.4.17",
"tailwind-percentage-heights-plugin": "^0.1.4"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/plugin-transform-react-jsx": "^7.10.4",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.1.0",
"compression-webpack-plugin": "^6.0.3",
"css-loader": "^4.3.0",
"file-loader": "^6.1.0",
"html-webpack-plugin": "^4.5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react'
import { h } from 'preact';
import { useState} from 'preact/hooks'
import Home from './components/home'
import './styles/main.css'

Expand Down
2 changes: 1 addition & 1 deletion src/components/alerts.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { h } from 'preact';

function Alert({ content, color }) {
return (
Expand Down
3 changes: 2 additions & 1 deletion src/components/canvas.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useRef } from 'react'
import { h } from 'preact';
import { useRef } from 'preact/hooks'
import SVGCode from './svgCode'

function Canvas({ svg }) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/customBar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react'
import { h } from 'preact';
import { useState } from 'preact/hooks'
import './../styles/sideBar.css'
import Water from './../assets/001-water.svg'
import { TwitterPicker } from 'react-color'
Expand Down
4 changes: 3 additions & 1 deletion src/components/home.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useRef, useState } from 'react'
import { h } from 'preact';
import { useRef, useState } from 'preact/hooks'
import Canvas from './canvas'
import CustomBar from './customBar'
import Navbar from './nav'
Expand Down Expand Up @@ -33,6 +34,7 @@ function Home({ isDark, toggleDarkMode }) {
<svg
height="100%"
width="100%"
id="bg-svg"
viewBox={`0 0 1440 ${height}`}
xmlns={xmlns}
ref={svgElement}
Expand Down
2 changes: 1 addition & 1 deletion src/components/logo.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { h } from 'preact';
import { shadeColor } from './../helpers/colorBlender';

function Logo({ color}) {
Expand Down
5 changes: 2 additions & 3 deletions src/components/nav.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { h } from 'preact';
import { DarkModeSwitch } from 'react-toggle-dark-mode'
import Github from './../assets/001-github.svg'
import underWave from './../assets/underwave.png'
Expand All @@ -12,8 +12,7 @@ function Navbar({ isDark, toggleDarkMode, color }) {
return (
<div className="fixed flex items-center justify-between w-full h-16 bg-white shadow-lg dark:bg-darkish-black dark:text-white">
<div className="flex items-center px-3 mx-3 font-sans text-lg font-bold nav-item max-h-16">
{/* <Logo color={color} /> */}
<img src={isDark ? dark : light} alt="" width="60px"/>
<img src={isDark ? dark : light} alt="" width="80"/>
<div className="relative logo-name">
<span className="text-black nav-logo dark:text-white"> Svg </span>
<span className="text-black nav-logo dark:text-white"> Wave </span>
Expand Down
3 changes: 2 additions & 1 deletion src/components/svgCode.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react'
import { h } from 'preact';
import { useState } from 'preact/hooks'
import { highlightCode } from '../helpers/highlighter'
import copyBtn from './../assets/001-copy.svg'

Expand Down
5 changes: 2 additions & 3 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { h, render } from 'preact';
import App from './App.jsx'
import './styles/main.css'

ReactDOM.render(<App />, document.getElementById('app'))
render(<App />, document.getElementById('app'))
Loading

0 comments on commit c972d95

Please sign in to comment.