diff --git a/src/components/Editor.js b/src/components/Editor.js index 66598e2..9e9369f 100644 --- a/src/components/Editor.js +++ b/src/components/Editor.js @@ -14,7 +14,8 @@ const defaultSettings = { icon: { 'label': 'react', 'value': 'react' }, devIconOptions: {}, font: 'font-sans', - theme: 'modern' + theme: 'modern', + customIcon: '' }; @@ -30,6 +31,7 @@ class Editor extends React.Component { componentDidMount() { console.log("Mount") fetch(devIconsUrl).then(r => r.json()).then(data => { + data.push({ name: 'custom' }) this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) }) }) } @@ -51,6 +53,24 @@ class Editor extends React.Component { ); + // customOption = props => { + // const { data, innerRef, innerProps } = props; + + // return data.name === 'custom' ? ( + //
+ // this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })} + // /> + //
+ // ) : ( + // + // ); + + + // }; + + render() { return (
@@ -136,6 +156,17 @@ class Editor extends React.Component { />
+ {this.state.icon.label === 'custom' ? +
+ this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })} + /> +
+ : +
+ } +
diff --git a/src/components/Themes/BasicTheme.js b/src/components/Themes/BasicTheme.js index 8ef1bcb..13d5b0b 100644 --- a/src/components/Themes/BasicTheme.js +++ b/src/components/Themes/BasicTheme.js @@ -2,7 +2,7 @@ import React from 'react'; const BasicTheme = ({ config }) => { - const { title, bgColor, pattern, author, icon, font } = config; + const { title, bgColor, pattern, author, icon, font, customIcon } = config; return (
@@ -19,7 +19,18 @@ const BasicTheme = ({ config }) => {
- + { + customIcon ? +
+ img +
+ : +
+ +
+ } + +

{author}

diff --git a/src/components/Themes/ModernTheme.js b/src/components/Themes/ModernTheme.js index a154461..9eaf15b 100644 --- a/src/components/Themes/ModernTheme.js +++ b/src/components/Themes/ModernTheme.js @@ -3,7 +3,7 @@ import React from 'react'; const ModernTheme = ({ config }) => { - const { title, bgColor, pattern, author, icon, font } = config; + const { title, bgColor, pattern, author, icon, font, customIcon } = config; return (
@@ -11,9 +11,18 @@ const ModernTheme = ({ config }) => {
-
- -
+ + { + customIcon ? +
+ img +
+ : +
+ +
+ } +
@@ -22,7 +31,7 @@ const ModernTheme = ({ config }) => {
- +
diff --git a/src/components/Themes/OutlineTheme.js b/src/components/Themes/OutlineTheme.js index 6e9e7c3..4573d39 100644 --- a/src/components/Themes/OutlineTheme.js +++ b/src/components/Themes/OutlineTheme.js @@ -1,6 +1,6 @@ import React from 'react'; const OutlineTheme = ({ config }) => { - const { title, bgColor, pattern, author, icon, font } = config; + const { title, bgColor, pattern, author, icon, font, customIcon } = config; return (
@@ -22,7 +22,16 @@ const OutlineTheme = ({ config }) => {
- + { + customIcon ? +
+ img +
+ : +
+ +
+ }

{author}