summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2019-03-19 23:53:47 -0700
committerNick Van Doorn <vandoorn.nick@gmail.com>2019-03-19 23:53:47 -0700
commit8e722c2ecd342bb16b6f74ca0a9efa9958ca79cc (patch)
tree7dc6828c669445cf7f0070d7807bc8b543bf0f1d
parenta129f139623c85456d2d15bd92d7fd4dad44afb4 (diff)
Implement custom FontAwesome component to avoid cold cache issues
-rw-r--r--src/components/font-awesome.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/components/font-awesome.js b/src/components/font-awesome.js
new file mode 100644
index 0000000..6dc9e17
--- /dev/null
+++ b/src/components/font-awesome.js
@@ -0,0 +1,23 @@
+import React from 'react'
+import { css } from '@emotion/core'
+
+const DEFAULT_SIZE = '20px'
+
+export const FontAwesome = ({ icon: outerIcon, size, fill }) => {
+ const svgStyle = css`
+ width: ${size || DEFAULT_SIZE};
+ height: ${size || DEFAULT_SIZE};
+ ${fill
+ ? `& path {
+ fill: ${fill};
+ }`
+ : ''}
+ `
+ const { icon, iconName } = outerIcon
+ return (
+ <svg css={svgStyle} viewBox={`0 0 ${icon[1]} ${icon[1]}`}>
+ <path d={icon[4]} />
+ <desc>{iconName}</desc>
+ </svg>
+ )
+}