rolled back btn

This commit is contained in:
Ulysia 2024-10-14 09:09:28 +02:00
parent 0540dd89a0
commit 15ce70b404

View file

@ -3,52 +3,51 @@ import baseStyle from "./styles/footer.scss"
import { useEffect, useState } from "preact/hooks" import { useEffect, useState } from "preact/hooks"
// Import the JSON data // Import the JSON data
import buttonsData from "./buttons.json" import buttonsData from "../buttons.json"
// Define the component export default (() => {
const Btn8831: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { // Define the component
// Since the data is static, you can directly use buttonsData const Btn8831: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const [buttons, setButtons] = useState(buttonsData) // Since the data is static, you can directly use buttonsData
const [buttons, setButtons] = useState(buttonsData)
// Optional: If you need to perform any data manipulation or sorting, you can do it here // Optional: If you need to perform any data manipulation or sorting, you can do it here
// For example, if buttonsData isn't sorted, but you need to sort it: // For example, if buttonsData isn't sorted, but you need to sort it:
// useEffect(() => { // useEffect(() => {
// const sortedButtons = [...buttonsData].sort(/* your sorting function */); // const sortedButtons = [...buttonsData].sort(/* your sorting function */);
// setButtons(sortedButtons); // setButtons(sortedButtons);
// }, []); // }, []);
return ( return (
<div class={`btn8831-container ${displayClass ?? ""}`}> <div class={`btn8831-container ${displayClass ?? ""}`}>
{buttons.map((button, index) => ( {buttons.map((button, index) => (
<a href={button.url} key={index}> <a href={button.url} key={index}>
<img src={button.image} alt={button.alt} /> <img src={button.image} alt={button.alt} />
</a> </a>
))} ))}
</div> </div>
) )
}
// Define custom styles
const customStyle = `
.btn8831-container {
display: flex;
flex-wrap: wrap;
max-width: 60%;
margin: 0 auto;
opacity: 1;
justify-content: center;
} }
.btn8831-container a {
margin: 5px;
}
.btn8831-container img {
width: 88px;
height: 31px;
}
`
// Combine base styles with custom styles // Define custom styles
Btn8831.css = customStyle const customStyle = `
.btn8831-container {
display: flex;
flex-wrap: wrap;
max-width: 60%;
margin: 0 auto;
}
.btn8831-container a {
margin: 5px;
}
.btn8831-container img {
width: 88px;
height: 31px;
}
`
// Combine base styles with custom styles
Btn8831.css = baseStyle + customStyle
export default (() => Btn8831) satisfies QuartzComponentConstructor return Btn8831
})() satisfies QuartzComponentConstructor