-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7ab375
commit b0320ff
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from 'react'; | ||
import { Button, Form, Card } from 'react-bootstrap'; | ||
|
||
const IconPreviewInterface = () => { | ||
const [selectedIcon, setSelectedIcon] = useState(''); | ||
const [previewUrl, setPreviewUrl] = useState(''); | ||
const [badgeUrl, setBadgeUrl] = useState(''); | ||
|
||
const handleIconChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
const icon = e.target.value; | ||
setSelectedIcon(icon); | ||
const url = `https://custom-icon-badges.demolab.com/badge/preview-${icon}-blue?logo=${icon}`; | ||
setPreviewUrl(url); | ||
setBadgeUrl(`https://custom-icon-badges.demolab.com/badge/your-badge-blue?logo=${icon}`); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h2>Icon Preview Interface</h2> | ||
<Form> | ||
<Form.Group controlId="iconSelect"> | ||
<Form.Label>Select an Icon</Form.Label> | ||
<Form.Control as="select" value={selectedIcon} onChange={handleIconChange}> | ||
<option value="">Select an icon...</option> | ||
<option value="octicon">Octicon</option> | ||
<option value="feather">Feather</option> | ||
{/* Future options for other icon libraries can be added here */} | ||
</Form.Control> | ||
</Form.Group> | ||
{previewUrl && ( | ||
<Card> | ||
<Card.Body> | ||
<Card.Title>Badge Preview</Card.Title> | ||
<img src={previewUrl} alt="Badge Preview" /> | ||
</Card.Body> | ||
</Card> | ||
)} | ||
{badgeUrl && ( | ||
<Form.Group controlId="badgeUrl"> | ||
<Form.Label>Badge URL</Form.Label> | ||
<Form.Control type="text" readOnly value={badgeUrl} /> | ||
<Button variant="primary" onClick={() => navigator.clipboard.writeText(badgeUrl)}> | ||
Copy URL | ||
</Button> | ||
</Form.Group> | ||
)} | ||
</Form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default IconPreviewInterface; |