Skip to content

Commit

Permalink
Merge pull request #22 from priyankeshh/main
Browse files Browse the repository at this point in the history
#6 Added 9 different logos which can be used on the website
  • Loading branch information
ayuugoyal authored Oct 6, 2023
2 parents 3cdab4e + b6b7caf commit 560ccab
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 125 deletions.
77 changes: 53 additions & 24 deletions components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,64 @@ function ThemeToggle() {
if (!mounted) return null;

const toggleTheme = () => {
const targetTheme = resolvedTheme === "light" ? "dark" : "light";

const targetTheme = resolvedTheme === 'light' ? 'dark' : 'light';
setTheme(targetTheme);
};

const sliderStyle = {
width: '70px',
height: '25px',
borderRadius: '12.5px',
backgroundColor: resolvedTheme === 'dark' ? '#333' : '#ddd',
position: 'relative' as 'relative',
cursor: 'pointer',
transition: 'background-color 0.3s',
};

const knobStyle = {
width: '25px',
height: '25px',
borderRadius: '50%',
backgroundColor: resolvedTheme === 'dark' ? '#ddd' : '#333',
position: 'absolute' as 'absolute',
top: '50%',
transform: 'translateY(-50%)',
left: resolvedTheme === 'dark' ? '0' : '45px',
transition: 'left 0.3s, background-color 0.3s',
};

const textStyle = {
position: 'absolute' as 'absolute',
top: '50%',
transform: 'translateY(-50%)',
width: '100%',
textAlign: 'center',
fontSize: '14px',
fontWeight: 'bold',
color: resolvedTheme === 'dark' ? '#333' : '#ddd',
};

return (
<button onClick={toggleTheme}
style={{
display: 'flex',
flexDirection: 'row-reverse',
marginLeft:"auto",
marginTop:"2rem",
marginRight:"2rem",
}}>
{resolvedTheme === 'dark' ? (
<svg width="27" height="27" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" ><path d="M7.5 0C7.77614 0 8 0.223858 8 0.5V2.5C8 2.77614 7.77614 3 7.5 3C7.22386 3 7 2.77614 7 2.5V0.5C7 0.223858 7.22386 0 7.5 0ZM2.1967 2.1967C2.39196 2.00144 2.70854 2.00144 2.90381 2.1967L4.31802 3.61091C4.51328 3.80617 4.51328 4.12276 4.31802 4.31802C4.12276 4.51328 3.80617 4.51328 3.61091 4.31802L2.1967 2.90381C2.00144 2.70854 2.00144 2.39196 2.1967 2.1967ZM0.5 7C0.223858 7 0 7.22386 0 7.5C0 7.77614 0.223858 8 0.5 8H2.5C2.77614 8 3 7.77614 3 7.5C3 7.22386 2.77614 7 2.5 7H0.5ZM2.1967 12.8033C2.00144 12.608 2.00144 12.2915 2.1967 12.0962L3.61091 10.682C3.80617 10.4867 4.12276 10.4867 4.31802 10.682C4.51328 10.8772 4.51328 11.1938 4.31802 11.3891L2.90381 12.8033C2.70854 12.9986 2.39196 12.9986 2.1967 12.8033ZM12.5 7C12.2239 7 12 7.22386 12 7.5C12 7.77614 12.2239 8 12.5 8H14.5C14.7761 8 15 7.77614 15 7.5C15 7.22386 14.7761 7 14.5 7H12.5ZM10.682 4.31802C10.4867 4.12276 10.4867 3.80617 10.682 3.61091L12.0962 2.1967C12.2915 2.00144 12.608 2.00144 12.8033 2.1967C12.9986 2.39196 12.9986 2.70854 12.8033 2.90381L11.3891 4.31802C11.1938 4.51328 10.8772 4.51328 10.682 4.31802ZM8 12.5C8 12.2239 7.77614 12 7.5 12C7.22386 12 7 12.2239 7 12.5V14.5C7 14.7761 7.22386 15 7.5 15C7.77614 15 8 14.7761 8 14.5V12.5ZM10.682 10.682C10.8772 10.4867 11.1938 10.4867 11.3891 10.682L12.8033 12.0962C12.9986 12.2915 12.9986 12.608 12.8033 12.8033C12.608 12.9986 12.2915 12.9986 12.0962 12.8033L10.682 11.3891C10.4867 11.1938 10.4867 10.8772 10.682 10.682ZM5.5 7.5C5.5 6.39543 6.39543 5.5 7.5 5.5C8.60457 5.5 9.5 6.39543 9.5 7.5C9.5 8.60457 8.60457 9.5 7.5 9.5C6.39543 9.5 5.5 8.60457 5.5 7.5ZM7.5 4.5C5.84315 4.5 4.5 5.84315 4.5 7.5C4.5 9.15685 5.84315 10.5 7.5 10.5C9.15685 10.5 10.5 9.15685 10.5 7.5C10.5 5.84315 9.15685 4.5 7.5 4.5Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd" ></path></svg>
):(
<svg width="27" height="27" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.54406 0.98184L8.24618 0.941586C8.03275 0.917676 7.90692 1.1655 8.02936 1.34194C8.17013 1.54479 8.29981 1.75592 8.41754 1.97445C8.91878 2.90485 9.20322 3.96932 9.20322 5.10022C9.20322 8.37201 6.82247 11.0878 3.69887 11.6097C3.45736 11.65 3.20988 11.6772 2.96008 11.6906C2.74563 11.702 2.62729 11.9535 2.77721 12.1072C2.84551 12.1773 2.91535 12.2458 2.98667 12.3128L3.05883 12.3795L3.31883 12.6045L3.50684 12.7532L3.62796 12.8433L3.81491 12.9742L3.99079 13.089C4.11175 13.1651 4.23536 13.2375 4.36157 13.3059L4.62496 13.4412L4.88553 13.5607L5.18837 13.6828L5.43169 13.7686C5.56564 13.8128 5.70149 13.8529 5.83857 13.8885C5.94262 13.9155 6.04767 13.9401 6.15405 13.9622C6.27993 13.9883 6.40713 14.0109 6.53544 14.0298L6.85241 14.0685L7.11934 14.0892C7.24637 14.0965 7.37436 14.1002 7.50322 14.1002C11.1483 14.1002 14.1032 11.1453 14.1032 7.50023C14.1032 7.25044 14.0893 7.00389 14.0623 6.76131L14.0255 6.48407C13.991 6.26083 13.9453 6.04129 13.8891 5.82642C13.8213 5.56709 13.7382 5.31398 13.6409 5.06881L13.5279 4.80132L13.4507 4.63542L13.3766 4.48666C13.2178 4.17773 13.0353 3.88295 12.8312 3.60423L12.6782 3.40352L12.4793 3.16432L12.3157 2.98361L12.1961 2.85951L12.0355 2.70246L11.8134 2.50184L11.4925 2.24191L11.2483 2.06498L10.9562 1.87446L10.6346 1.68894L10.3073 1.52378L10.1938 1.47176L9.95488 1.3706L9.67791 1.2669L9.42566 1.1846L9.10075 1.09489L8.83599 1.03486L8.54406 0.98184ZM10.4032 5.30023C10.4032 4.27588 10.2002 3.29829 9.83244 2.40604C11.7623 3.28995 13.1032 5.23862 13.1032 7.50023C13.1032 10.593 10.596 13.1002 7.50322 13.1002C6.63646 13.1002 5.81597 12.9036 5.08355 12.5522C6.5419 12.0941 7.81081 11.2082 8.74322 10.0416C8.87963 10.2284 9.10028 10.3497 9.34928 10.3497C9.76349 10.3497 10.0993 10.0139 10.0993 9.59971C10.0993 9.24256 9.84965 8.94373 9.51535 8.86816C9.57741 8.75165 9.63653 8.63334 9.6926 8.51332C9.88358 8.63163 10.1088 8.69993 10.35 8.69993C11.0403 8.69993 11.6 8.14028 11.6 7.44993C11.6 6.75976 11.0406 6.20024 10.3505 6.19993C10.3853 5.90487 10.4032 5.60464 10.4032 5.30023Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"/>
</svg>

)}
</button>
<div
style={{
position: 'fixed',
top: '2rem',
right: '2rem',
zIndex: 9999, // Ensure it's above other content
}}
>
<div
style={sliderStyle}
onClick={toggleTheme}
className="theme-slider"
role="button"
tabIndex={0}
>
<div style={textStyle}>{resolvedTheme === 'dark' ? 'Dark' : 'Light'}</div>
<div style={knobStyle} className="theme-knob"></div>
</div>
</div>
);
}

export default ThemeToggle;



12 changes: 12 additions & 0 deletions components/logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// components/logo.tsx
import React from 'react';

const Logo = () => {
return (
<div className="logo" style={{ width: '200px', height: '200px'}}>
<img src="/logo1-removebg-preview.png" alt="ArtiGenius-AI" style={{ width: '200px', height: '200px' }} />
</div>
);
};

export default Logo;
71 changes: 66 additions & 5 deletions components/prompt-form.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import React, { useState, useRef } from 'react';
import { useTheme } from 'next-themes';
import * as Form from '@radix-ui/react-form';
import { styled } from '@stitches/react';

const fontFamily = "'Poppins', sans-serif";

type Props = {
onSubmit: (prompt: string) => void;
isGenerating: boolean;
Expand All @@ -14,6 +16,50 @@ export const PromptForm: React.FC<Props> = ({ onSubmit, isGenerating }) => {
const { theme, resolvedTheme } = useTheme();
const currentTheme: ThemeVariants = (theme || resolvedTheme || 'light') as ThemeVariants;

const [randomPrompt, setRandomPrompt] = useState<string | null>(null);
const promptInputRef = useRef<HTMLInputElement | null>(null);

const handleSurpriseMeClick = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();

//An array of random prompts
const randomPrompts = [
'A beautiful sunset over the ocean',
'A cozy cabin in the woods',
'A futuristic cityscape',
'A beautiful sunset over the ocean',
'A cozy cabin in the woods',
'A futuristic cityscape',
'An enchanted forest with talking animals',
'A bustling market in a foreign land',
'A magical kingdom hidden in the clouds',
'A secret underground laboratory',
'A time-traveling adventure to the past',
'Exploring an alien planet with strange creatures',
'A pirate ship sailing the high seas',
'A haunted house on a dark and stormy night',
'An epic battle between dragons and knights',
'A journey through a mysterious portal',
'A hidden treasure map leading to riches',
'A deserted island with a message in a bottle',
'A parallel universe with alternate versions of yourself',
'A quest to save the world from an evil sorcerer',
'A trip to the moon in a rocket ship',
'A magical spell that goes awry',
'A visit to a futuristic city of robots',

];


const randomIndex = Math.floor(Math.random() * randomPrompts.length);
const randomPrompt = randomPrompts[randomIndex];


if (promptInputRef.current) {
promptInputRef.current.value = randomPrompt;
}
};

const handleSubmit: React.FormEventHandler<HTMLFormElement> = (e) => {
e.preventDefault();

Expand All @@ -33,18 +79,28 @@ export const PromptForm: React.FC<Props> = ({ onSubmit, isGenerating }) => {
<StyledInput
type="text"
name="prompt"
ref={promptInputRef}
required
placeholder="Enter a prompt like 'a painting of a cat'"
autoComplete="off"
theme={currentTheme}
/>
</Form.Control>
</StyledFormField>
<Form.Submit asChild>
<StyledButton css={{ marginTop: 10 }} disabled={isGenerating}>
{isGenerating ? 'Generating..' : 'Start Generating'}
<StyledFlex css={{ alignItems: 'center' }}>
<Form.Submit asChild>
<StyledButton css={{ marginRight: 5, flex: 1, borderRadius: 15 }} disabled={isGenerating}>
{isGenerating ? 'Generating..' : 'Start Generating'}
</StyledButton>
</Form.Submit>
<StyledButton
css={{ marginLeft: 5, flex: 1, borderRadius: 15 }}
onClick={handleSurpriseMeClick}
type="button" // Added type="button" to prevent generation on its own
>
Surprise Me
</StyledButton>
</Form.Submit>
</StyledFlex>
</StyledFormRoot>
);
};
Expand All @@ -61,12 +117,14 @@ const StyledFormLabel = styled(Form.Label, {
fontWeight: 500,
lineHeight: '35px',
color: '$foreground',
fontFamily: fontFamily,
});

const StyledFormMessage = styled(Form.Message, {
fontSize: 13,
color: '$red600',
opacity: 0.8,
fontFamily: fontFamily,
});

const StyledFlex = styled('div', { display: 'flex' });
Expand All @@ -87,13 +145,15 @@ const inputStyles = {
'&:hover': { boxShadow: '0 0 0 1px $gray600' },
'&:focus': { boxShadow: '0 0 0 2px $purple600' },
'&::selection': { backgroundColor: '$gray600', color: 'white' },
fontFamily: fontFamily,
};

const StyledInput = styled('input', {
...inputStyles,
height: 35,
lineHeight: 1,
padding: '0 10px',
borderRadius: 15,
variants: {
theme: {
dark: {
Expand Down Expand Up @@ -133,4 +193,5 @@ const StyledButton = styled('button', {
boxShadow: '0 2px 10px $gray400',
'&:not(:disabled):hover': { backgroundColor: '$purple600' },
'&:not(:disabled):focus': { boxShadow: '0 0 0 2px black' },
fontFamily: fontFamily,
});
Loading

0 comments on commit 560ccab

Please sign in to comment.