Skip to content

Instantly share code, notes, and snippets.

@rahulmore01
Created December 30, 2023 11:31
Show Gist options
  • Save rahulmore01/111cf047393aa3ffe265ecb59815763c to your computer and use it in GitHub Desktop.
Save rahulmore01/111cf047393aa3ffe265ecb59815763c to your computer and use it in GitHub Desktop.
genui project
import UiToggle from "@/components/UiToggle";
import React, { useState } from "react";
interface GenerateUiProps {
onToggleCode: (newToggleCodeValue: boolean) => void;
}
const GenerateUi: React.FC<GenerateUiProps> = ({ onToggleCode }) => {
const [isToggleCode, setIsToggleCode] = useState(true);
const handleToggleCode = (newToggleCodeValue: boolean) => {
setIsToggleCode(newToggleCodeValue);
};
return (
<section className="flex flex-col bg-primary_light_color bg-opacity-15 h-full w-full rounded-lg">
{/* generate ui options */}
<div className="flex justify-between items-center p-3">
<div className="flex justify-start items-center gap-2">
<div className="h-9 w-9 bg-white rounded-full border border-primary_color border-opacity-60"></div>
<h6>A luxury fashion brand landing page</h6>
</div>
<UiToggle onToggleCode={handleToggleCode} />
</div>
{/* generate ui flip functionality */}
<div className="w-full h-full bg-secondary_color text-primary p-4">
{isToggleCode ? <UiView /> : <CodeView />}
</div>
</section>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment