-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8674705
commit c26de84
Showing
22 changed files
with
1,084 additions
and
2,548 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,76 @@ | ||
import postcss from 'rollup-plugin-postcss' | ||
import css from "rollup-plugin-import-css"; | ||
import css from 'rollup-plugin-import-css' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import withSolid from 'rollup-preset-solid' | ||
import babel from '@rollup/plugin-babel' | ||
import terser from '@rollup/plugin-terser' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import resolve from '@rollup/plugin-node-resolve' | ||
|
||
export default withSolid([ | ||
const extensions = ['.js', '.jsx', '.ts', '.tsx'] | ||
|
||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
output: '.', | ||
plugins: [css(), typescript()] | ||
output: { | ||
file: 'dist/bundle.js', | ||
format: 'iife', | ||
name: 'MyApp', | ||
sourcemap: true | ||
}, | ||
plugins: [ | ||
resolve({ extensions }), | ||
commonjs(), | ||
// postcss({ | ||
// extract: true, | ||
// minimize: true, | ||
// sourceMap: true, | ||
// }), | ||
css(), | ||
typescript({ | ||
tsconfig: 'tsconfig.json' | ||
}), | ||
babel({ | ||
extensions, | ||
babelHelpers: 'bundled', | ||
include: ['src/**/*'], | ||
presets: [['@babel/preset-react', { runtime: 'automatic' }]] | ||
}), | ||
// terser() | ||
] | ||
}, | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: 'dist/cjs/index.js', | ||
format: 'cjs' | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: 'dist/esm/index.js', | ||
format: 'esm' | ||
format: 'esm', | ||
sourcemap: true | ||
} | ||
], | ||
plugins: [css(), typescript()] | ||
plugins: [ | ||
resolve({ extensions }), | ||
commonjs(), | ||
// postcss({ | ||
// extract: true, | ||
// minimize: true, | ||
// sourceMap: true, | ||
// }), | ||
css(), | ||
typescript({ | ||
tsconfig: 'tsconfig.json' | ||
}), | ||
babel({ | ||
extensions, | ||
babelHelpers: 'bundled', | ||
include: ['src/**/*'], | ||
presets: [['@babel/preset-react', { runtime: 'automatic' }]] | ||
}), | ||
// terser() | ||
] | ||
} | ||
]) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
const fs = require('fs') | ||
// const fs = require('fs') | ||
|
||
// Read the file into a string | ||
let fileData = fs.readFileSync('./dist/cjs/index.js', 'utf8') | ||
// // Read the file into a string | ||
// let fileData = fs.readFileSync('./dist/cjs/index.js', 'utf8') | ||
|
||
// Define the code you want to insert | ||
const codeToInsert = `if (web.isServer) { | ||
web.template = () => { | ||
return { cloneNode: () => {} } | ||
} | ||
}` | ||
// // Define the code you want to insert | ||
// const codeToInsert = `if (web.isServer) { | ||
// web.template = () => { | ||
// return { cloneNode: () => {} } | ||
// } | ||
// }` | ||
|
||
// Split the file into an array of lines | ||
let fileLines = fileData.split('\n') | ||
// // Split the file into an array of lines | ||
// let fileLines = fileData.split('\n') | ||
|
||
// Insert the code into the desired line (line number starting from 0) | ||
const lineToInsert = 5 | ||
fileLines.splice(lineToInsert, 0, codeToInsert) | ||
// // Insert the code into the desired line (line number starting from 0) | ||
// const lineToInsert = 5 | ||
// fileLines.splice(lineToInsert, 0, codeToInsert) | ||
|
||
// Join the modified lines into a string | ||
fileData = fileLines.join('\n') | ||
// // Join the modified lines into a string | ||
// fileData = fileLines.join('\n') | ||
|
||
// Write the modified file back to disk | ||
fs.writeFileSync('./dist/cjs/index.js', fileData) | ||
// // Write the modified file back to disk | ||
// fs.writeFileSync('./dist/cjs/index.js', fileData) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,104 @@ | ||
import { Component, onCleanup, onMount } from 'solid-js' | ||
import { CloseIcon, LeftIcon, LogoIcon } from '../icons' | ||
import Loader from '../loader' | ||
import React, { useEffect } from "react"; | ||
import { CloseIcon, LeftIcon, LogoIcon } from "../icons"; | ||
import Loader from "../loader"; | ||
|
||
export interface AlertProps { | ||
content: any | ||
open: boolean | ||
showMore?: boolean | ||
extraContent?: any | ||
loading?: boolean | ||
onCloseClick: () => void | ||
onClickShowMore?: () => void | ||
onBackClick?: () => void | ||
content: any; | ||
open: boolean; | ||
showMore?: boolean; | ||
extraContent?: any; | ||
loading?: boolean; | ||
onCloseClick: () => void; | ||
onClickShowMore?: () => void; | ||
onBackClick?: () => void; | ||
} | ||
|
||
const Alert: Component<AlertProps> = (props: AlertProps) => { | ||
let prevBodyOverflow: any = null | ||
onMount(() => { | ||
prevBodyOverflow = document.body.style.overflow | ||
document.body.style.overflow = 'hidden' | ||
}) | ||
const Alert: React.FC<AlertProps> = (props: AlertProps) => { | ||
useEffect(() => { | ||
const prevBodyOverflow = document.body.style.overflow; | ||
document.body.style.overflow = "hidden"; | ||
|
||
onCleanup(() => { | ||
document.body.style.overflow = prevBodyOverflow | ||
}) | ||
return () => { | ||
document.body.style.overflow = prevBodyOverflow; | ||
}; | ||
}, []); | ||
|
||
const isMobile = window.innerWidth <= 800 | ||
const isMobile = window.innerWidth <= 800; | ||
|
||
return ( | ||
<div | ||
class={props.open ? 'alert-wrapper-show' : 'alert-wrapper-hide'} | ||
onClick={() => { | ||
props.onCloseClick() | ||
}} | ||
className={props.open ? "alert-wrapper-show" : "alert-wrapper-hide"} | ||
onClick={props.onCloseClick} | ||
> | ||
<div | ||
class={props.open ? 'alert-modal-show' : 'alert-modal-hide'} | ||
onClick={(e: any) => { | ||
e.stopPropagation() | ||
className={props.open ? "alert-modal-show" : "alert-modal-hide"} | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
}} | ||
> | ||
<div class="alert-header"> | ||
{props.onBackClick && ( | ||
<div class="alert-button-icon" onClick={props.onBackClick}> | ||
<div className="alert-header"> | ||
{props.onBackClick ? ( | ||
<div className="alert-button-icon" onClick={props.onBackClick}> | ||
<LeftIcon /> | ||
</div> | ||
) : ( | ||
<div className="alert-button-icon-empty"></div> | ||
)} | ||
{!props.onBackClick && <div class="alert-button-icon-empty"></div>} | ||
<div class="alert-logo"> | ||
<div className="alert-logo"> | ||
<LogoIcon /> | ||
</div> | ||
<div class="alert-button-icon" onClick={props.onCloseClick}> | ||
<div className="alert-button-icon" onClick={props.onCloseClick}> | ||
<CloseIcon /> | ||
</div> | ||
</div> | ||
<div | ||
class="alert-modal-loading-wrapper" | ||
className="alert-modal-loading-wrapper" | ||
style={ | ||
props.loading | ||
? { | ||
opacity: 1, | ||
transition: 'all ease 0.3s', | ||
height: '14px', | ||
overflow: 'unset', | ||
width: 'unset' | ||
transition: "all ease 0.3s", | ||
height: "14px", | ||
overflow: "unset", | ||
width: "unset", | ||
} | ||
: { | ||
opacity: 0, | ||
transition: "all ease 0.3s", | ||
height: 0, | ||
overflow: "hidden", | ||
width: 0, | ||
} | ||
: { opacity: 0, transition: 'all ease 0.3s', height: 0, overflow: 'hidden', width: 0 } | ||
} | ||
> | ||
<Loader /> | ||
</div> | ||
<div class="alert-body" style={{ 'margin-bottom': props.extraContent ? '' : '1.8em' }}> | ||
<div | ||
className="alert-body" | ||
style={{ marginBottom: props.extraContent ? "" : "1.8em" }} | ||
> | ||
{props.content} | ||
{!isMobile && ( | ||
<div class={props.showMore ? 'alert-body-extra-show' : 'alert-body-extra-hide'}> | ||
{props.extraContent && <div class="alert-divider"></div>} | ||
<div | ||
className={ | ||
props.showMore | ||
? "alert-body-extra-show" | ||
: "alert-body-extra-hide" | ||
} | ||
> | ||
{props.extraContent && <div className="alert-divider"></div>} | ||
{props.extraContent} | ||
</div> | ||
)} | ||
</div> | ||
{!isMobile && props.extraContent && ( | ||
<div | ||
class="alert-footer" | ||
onClick={() => { | ||
if (props.onClickShowMore) props.onClickShowMore() | ||
}} | ||
> | ||
{props.showMore ? 'Show less' : 'Show more'} | ||
<div className="alert-footer" onClick={props.onClickShowMore}> | ||
{props.showMore ? "Show less" : "Show more"} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default Alert | ||
export default Alert; |
Oops, something went wrong.