Merge pull request #37 from rutikwankhade/fix-custom-icon

Fix custom icon order
This commit is contained in:
Rutik Wankhade 2024-10-13 12:52:49 +05:30 committed by GitHub
commit 7623b2f8a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ Creating cover images for your blogs is now super easy.
<img src="https://gist.github.com/user-attachments/assets/5b57a9fb-4791-4681-8982-9e47d7ba8ee1.png
<img src="https://gist.github.com/user-attachments/assets/1d1c1833-29bc-45d6-97dd-e26c2d1019cb
" height="auto" width="800px" margin="20px">

View File

@ -34,7 +34,7 @@ class Editor extends React.Component {
componentDidMount() {
// console.log("Mount")
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 })) })
})
}
@ -111,10 +111,10 @@ class Editor extends React.Component {
</div>
<div className="w-full">
{this.state.icon.label === 'custom' ?
<div className="flex items-center justify-center w-72 mx-auto">
{this.state.icon.label === 'upload your own' ?
<div className="flex items-center justify-center w-64 mx-auto">
<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]) })}
/>
</div>