- Notifications
You must be signed in to change notification settings - Fork39
Icons, Fonts & Notifications#102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
2ab6c3a
dee6684
e3f7a84
27324bc
f7d82c8
feeaf97
8dc00aa
fc5d41c
f6b0bda
a85dd93
5a6120b
be1e1db
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* css url font paths do not match up from the web-app as it is moved inside of build | ||
* in order to load fonts and icons, these paths must be reconciled. | ||
*/ | ||
const fs = require('fs') // eslint-disable-line | ||
// find the generated main css file | ||
const getMainCSSFile = () => { | ||
const regex = /^main.[a-z0-9]+.chunk.css$/ | ||
const mainCss = fs.readdirSync('build/static/css').filter(filename => filename.match(regex)) | ||
if (!mainCss.length) { | ||
throw new Error('No main.css file found in build/static/css') | ||
} | ||
return mainCss[0] | ||
} | ||
// remap the font paths from the borken /fonts/ => ../../fonts/ | ||
const remapFontPaths = () => { | ||
const mainCSSFile = getMainCSSFile() | ||
const file = fs.readFileSync(`build/static/css/${mainCSSFile}`, 'utf8') | ||
const fontUrlRegex = /url\(\/fonts\//g | ||
const remappedFile = file.replace(fontUrlRegex, 'url(../../fonts/') | ||
fs.writeFileSync(`build/static/css/${mainCSSFile}`, remappedFile) | ||
} | ||
remapFontPaths() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Message from '../Message' | ||
import * as React from 'react' | ||
import * as T from 'typings' | ||
import { css, jsx } from '@emotion/core' | ||
const durations = { | ||
success: 1000, | ||
warning: 4500, | ||
error: 4500, | ||
loading: 300000, | ||
} | ||
const useTimeout = ({ duration, key }: { duration: number; key: string }) => { | ||
const [timeoutClose, setTimeoutClose] = React.useState(false) | ||
React.useEffect(() => { | ||
setTimeoutClose(false) | ||
const timeout = setTimeout(() => { | ||
setTimeoutClose(true) | ||
}, duration) | ||
return () => { | ||
clearTimeout(timeout) | ||
} | ||
}, [key]) | ||
return timeoutClose | ||
} | ||
const TestMessage = (props: T.TestStatus) => { | ||
const duration = durations[props.type] | ||
const timeoutClose = useTimeout({ duration, key: props.title }) | ||
return ( | ||
<Message | ||
key={props.title} | ||
type={props.type} | ||
title={props.title} | ||
closed={timeoutClose} | ||
size="medium" | ||
closeable={props.type !== 'loading'} | ||
content={props.content} | ||
/> | ||
) | ||
} | ||
export default TestMessage |
Uh oh!
There was an error while loading.Please reload this page.