2024-12-19 23:16:04 +00:00
|
|
|
import "bulma";
|
2024-12-27 10:54:16 +00:00
|
|
|
import {useContext, useState} from "react";
|
2024-12-19 23:16:04 +00:00
|
|
|
import styles from './Item.module.css';
|
2024-12-27 10:54:16 +00:00
|
|
|
import appInfoCtx from "./appInfoCtx.js";
|
2024-12-19 23:16:04 +00:00
|
|
|
|
|
|
|
export default function Item({pos, callback}) {
|
|
|
|
let [loading, setLoading] = useState(false);
|
2024-12-27 10:54:16 +00:00
|
|
|
const appInfo = useContext(appInfoCtx);
|
2024-12-19 23:16:04 +00:00
|
|
|
return (<li className={'my-4 ' + styles.item}>
|
|
|
|
<div>
|
|
|
|
<div style={{"display": "inline-block"}} className="box m-4"><span>Item {pos}</span></div>
|
|
|
|
<button className={"button is-success m-4" + (loading ? " is-loading" : "")} onClick={() => {
|
|
|
|
setLoading(true);
|
|
|
|
setTimeout(() => {
|
|
|
|
callback('Clicked ' + pos);
|
|
|
|
setLoading(false);
|
|
|
|
}, 1000)
|
2024-12-27 10:54:16 +00:00
|
|
|
}}>Click me test 1 + 2 + 3
|
2024-12-19 23:16:04 +00:00
|
|
|
</button>
|
|
|
|
<button className="delete"/>
|
2024-12-27 10:54:16 +00:00
|
|
|
<span>App info: {appInfo}</span>
|
2024-12-19 23:16:04 +00:00
|
|
|
</div>
|
|
|
|
</li>);
|
|
|
|
}
|