Skip to content

Commit

Permalink
including a couple missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
j-paterson committed May 3, 2024
1 parent 096fce8 commit cc8cb00
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/fidgets/ui/gallery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { useState } from 'react';
import { RiPencilFill } from "react-icons/ri";
import Modal from "@/common/ui/components/Modal";

export default function Gallery() {

const images = ["image1","image2","image3"]

const [editMode, setMode] = useState(false);
const [imageURL, setImageURL] = useState("https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1024&h=1280&q=80");

function switchMode() {
setMode(!editMode);
}

const handleSubmit = (event) => {
const formData = new FormData(event.currentTarget);
event.preventDefault();
setImageURL(formData.get("URL"));
switchMode();
};

return (
<>
<div className ="row-span-4 col-span-4 rounded-md flex items-center justify-center overflow-hidden relative">
<img
src={`${imageURL}?${new Date().getTime()}`}
className = "inset-0 bg-cover bg-center z-0"
/>
<div className = "opacity-0 hover:opacity-100 duration-500 absolute inset-0 z-10 flex bg-slate-400 bg-opacity-50">
<button onClick={switchMode} className = "opacity-0 hover:opacity-100 duration-500 absolute inset-0 z-10 flex justify-center items-center text-white font-semibold text-4xl">
<RiPencilFill />
</button>
</div>
</div>
<Modal
open={editMode}
setOpen={setMode}
>
<form onSubmit={handleSubmit}>
<label>
<h2 className = "m-2">URL</h2>
<input name="URL" type="text" className = "p-2 m-2"/>
</label>
<br/>
<button type="submit" className = "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 m-2 rounded">
Update
</button>
</form>
</Modal>
</>
)
}
21 changes: 21 additions & 0 deletions src/pages/homebase/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Space from "@/common/ui/templates/space";
import Feed from "../feed";
import { useAccountStore } from "@/common/data/stores/useAccountStore";

function retrieveConfig(user, space){
const fidgetConfigs = {};
const layoutConfig = {}
const layoutID = "";

return ({fidgetConfigs, layoutConfig, layoutID})
}

export default function Homebase(spaceID) {

//const { getCurrentUser } = useAccountStore();
const user = useAccountStore.getState().accounts[0];

return (
<Space config={retrieveConfig(user, spaceID)} isEditable={true}></Space>
)
}

0 comments on commit cc8cb00

Please sign in to comment.