fix: keep custom icon option as first in icons

This commit is contained in:
Rutik Wankhade 2024-10-13 12:41:02 +05:30
parent ec33f5eaf4
commit 4ae14f5435

View File

@ -34,7 +34,7 @@ class Editor extends React.Component {
componentDidMount() { componentDidMount() {
// console.log("Mount") // console.log("Mount")
fetch(devIconsUrl).then(r => r.json()).then(data => { fetch(devIconsUrl).then(r => r.json()).then(data => {
data.push({ name: 'custom' }) data.unshift({ name: 'upload your own' })
this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) }) this.setState({ devIconOptions: data.map(item => ({ 'value': item.name, 'label': item.name })) })
}) })
} }
@ -111,10 +111,10 @@ class Editor extends React.Component {
</div> </div>
<div className="w-full"> <div className="w-full">
{this.state.icon.label === 'custom' ? {this.state.icon.label === 'upload your own' ?
<div className="flex items-center justify-center w-72 mx-auto"> <div className="flex items-center justify-center w-64 mx-auto">
<input type="file" <input type="file"
className="focus:outline-none w-full text-lg cursor-pointer bg-white rounded border" className="focus:outline-none w-full text-sm cursor-pointer bg-white rounded border"
onChange={(e) => this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })} onChange={(e) => this.setState({ 'customIcon': URL.createObjectURL(e.target.files[0]) })}
/> />
</div> </div>