diff --git a/src/App.scss b/src/App.scss index 1655c606..8bf1e58e 100644 --- a/src/App.scss +++ b/src/App.scss @@ -7,3 +7,82 @@ justify-content: center; color: white; } + +/* Styling for the new icon preview interface component */ +.icon-preview-interface { + margin-top: 2rem; + padding: 1rem; + border: 1px solid #2c2f36; + border-radius: 8px; + background-color: #24272e; + color: #ffffff; +} + +.icon-preview-interface select, +.icon-preview-interface input[type="text"] { + margin-top: 0.5rem; + margin-bottom: 1rem; +} + +.icon-preview-interface img { + max-width: 100%; + height: auto; + margin-top: 1rem; +} + +.icon-preview-interface .copy-url-btn { + margin-top: 1rem; +} + +/* Styles for the separate tab interface for the icon preview */ +.icon-tabs { + border-bottom: 1px solid #2c2f36; + padding-left: 0; + margin-bottom: 2rem; + list-style: none; + padding: 0; +} + +.icon-tab { + display: inline-block; + margin-right: 1rem; +} + +.icon-tab a { + padding: 0.5rem 1rem; + display: block; + text-decoration: none; + color: #ffffff; + background-color: #24272e; + border: 1px solid transparent; + border-radius: 4px; +} + +.icon-tab a:hover, +.icon-tab a:focus, +.icon-tab a.active { + color: #ffffff; + background-color: #1e212b; + border-color: #2c2f36; +} + +.icon-tab-content { + border: 1px solid #2c2f36; + border-radius: 8px; + background-color: #24272e; + color: #ffffff; + padding: 1rem; + margin-top: -1px; +} + +@media (max-width: 768px) { + .icon-tabs { + display: block; + } + + .icon-tab { + display: block; + margin-right: 0; + margin-bottom: 0.5rem; + } +} diff --git a/src/App.tsx b/src/App.tsx index 1c3f539d..f4fceb2d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,8 @@ import React from 'react'; import './App.scss'; import UploadForm from './UploadForm'; import GitHubButtons from './GitHubButtons'; +import IconPreviewInterface from './IconPreviewInterface'; +import { Tabs, Tab } from 'react-bootstrap'; /** * The root component of the application @@ -12,7 +14,14 @@ function App() {

Custom Icon Badges

- + + + + + + + +
); diff --git a/src/IconPreviewInterface.tsx b/src/IconPreviewInterface.tsx new file mode 100644 index 00000000..cf7a3300 --- /dev/null +++ b/src/IconPreviewInterface.tsx @@ -0,0 +1,79 @@ +import React, { useState, useEffect } from 'react'; +import { Button, Form, Card } from 'react-bootstrap'; + +const IconPreviewInterface = () => { + const [iconSource, setIconSource] = useState(''); + const [availableIcons, setAvailableIcons] = useState([]); + const [selectedIcon, setSelectedIcon] = useState(''); + const [previewUrl, setPreviewUrl] = useState(''); + const [badgeUrl, setBadgeUrl] = useState(''); + + useEffect(() => { + if (iconSource) { + // Fetch the list of available icons based on the selected source + fetch(`https://custom-icon-badges.demolab.com/api/icons?source=${iconSource}`) + .then((response) => response.json()) + .then((data) => setAvailableIcons(data.icons)) + .catch((error) => console.error('Error fetching icons:', error)); + } + }, [iconSource]); + + const handleIconSourceChange = (e: React.ChangeEvent) => { + setIconSource(e.target.value); + }; + + const handleIconChange = (e: React.ChangeEvent) => { + 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 ( +
+

Icon Preview Interface

+
+ + Select an Icon Source + + + + + {/* Future options for other icon sources can be added here */} + + + {iconSource && ( + + Select an Icon + + + {availableIcons.map((icon) => ( + + ))} + + + )} + {previewUrl && ( + + + Badge Preview + Badge Preview + + + )} + {badgeUrl && ( + + Badge URL + + + + )} +
+
+ ); +}; + +export default IconPreviewInterface;