-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c16297e
commit 9e45e34
Showing
18 changed files
with
309 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useState } from "react"; | ||
import { CreateCanvasWrapper, SizePickerContainer } from "./CreateCanvasStyles"; | ||
import { Label, Title } from "../shared-styles/Text"; | ||
import { InputStandard } from "../shared-styles/Input"; | ||
import { maxCanvasSize, minCanvasSize } from "../shared/Constants"; | ||
import { updateInput, validateAndConvertInput } from "../shared/SharedUtilities"; | ||
import { ButtonLarge } from "../shared-styles/Button"; | ||
|
||
interface CreateCanvasProps { | ||
initCanvas: Function; | ||
initCanvasFromSave: Function; | ||
} | ||
|
||
export function CreateCanvas(props: CreateCanvasProps) { | ||
const [name, setName] = useState<string>(''); | ||
const [width, setWidth] = useState<string>('10'); | ||
const [height, setHeight] = useState<string>('10'); | ||
|
||
return ( | ||
<> | ||
<CreateCanvasWrapper> | ||
<Title>Canvas Options</Title> | ||
|
||
<SizePickerContainer> | ||
<Label>GIF Name:</Label> | ||
<InputStandard type="text" | ||
value={name} | ||
placeholder="GIF Name" | ||
onMouseOver={(e) => {let element: HTMLInputElement = e.target as HTMLInputElement; element.focus();}} | ||
onChange={(e) => {setName(e.target.value)}}/> | ||
|
||
<Label>Width:</Label> | ||
<InputStandard type="number" | ||
min={minCanvasSize.toString()} | ||
max={maxCanvasSize.toString()} | ||
value={width} | ||
onMouseOver={(e) => {let element: HTMLInputElement = e.target as HTMLInputElement; element.focus();}} | ||
onChange={(e) => {updateInput(e, setWidth, 1, 3000)}}/> | ||
|
||
<Label>Height:</Label> | ||
<InputStandard type="number" | ||
min={minCanvasSize.toString()} | ||
max={maxCanvasSize.toString()} | ||
value={height} | ||
onMouseOver={(e) => {let element: HTMLInputElement = e.target as HTMLInputElement; element.focus();}} | ||
onChange={(e) => {updateInput(e, setHeight, 1, 3000)}}/> | ||
</SizePickerContainer> | ||
|
||
<ButtonLarge onClick={(e) => { | ||
props.initCanvas(name, validateAndConvertInput(width, minCanvasSize), validateAndConvertInput(height, minCanvasSize)); | ||
}}>create a canvas</ButtonLarge> | ||
</CreateCanvasWrapper> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import styled from "styled-components"; | ||
|
||
export const CreateCanvasWrapper = styled.div` | ||
width: min(70vw, 70vh); | ||
padding: max(4vw, 4vh); | ||
gap: 3vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: var(--secondary-color); | ||
`; | ||
|
||
export const SizePickerContainer = styled.div` | ||
width: inherit; | ||
display: grid; | ||
grid-template-columns: 4fr 10fr; | ||
grid-row-gap: min(1vw, 1vh); | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import styled from "styled-components"; | ||
|
||
export const GIFStorageWrapper = styled.div` | ||
width: min(70vw, 70vh); | ||
height: 20vh; | ||
padding: max(4vw, 4vh); | ||
gap: 3vh; | ||
overflow-y: scroll; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: flex-start; | ||
background-color: var(--secondary-color); | ||
`; | ||
|
||
export const GIFStorageItemWrapper = styled.div` | ||
width: min(63vw, 63vh); | ||
height: 75px; | ||
padding: max(1.5vw, 1.5vh); | ||
gap: 10px; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-start; | ||
background-color: var(--primary-color); | ||
`; | ||
|
||
export const GIFStorageItemPreviewWrapper = styled.div` | ||
height: 90%; | ||
aspect-ratio: 1/1; | ||
margin-right: 10px; | ||
`; | ||
|
||
export const GIFStorageItemTitle = styled.p` | ||
font-size: var(--font-size-sm); | ||
color: var(--tertiary-color); | ||
flex-grow: 1; | ||
margin: 0px; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
`; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.