-
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
Showing
12 changed files
with
1,343 additions
and
863 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
to: src/pages/sketches/<%= name %>.tsx | ||
--- | ||
import SketchWrapper from 'components/SketchWrapper' | ||
import { NextPage } from 'next' | ||
import { ColorValue, Draw } from 'types/CustomP5' | ||
import { getDimensions } from 'util/canvasSizes' | ||
|
||
const <%= h.changeCase.pascal(name) %>: NextPage = () => { | ||
const dimensions: number[] = getDimensions('A4') | ||
const padding: number[] = [40] | ||
const background: ColorValue = [255, 253, 252] | ||
|
||
const draw: Draw = p5 => {} | ||
|
||
return ( | ||
<SketchWrapper | ||
draw={draw} | ||
dimensions={dimensions} | ||
padding={padding} | ||
background={background} | ||
/> | ||
) | ||
} | ||
|
||
export default <%= h.changeCase.pascal(name) %> |
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 |
---|---|---|
@@ -1,40 +1,41 @@ | ||
{ | ||
"name": "p5-starter", | ||
"version": "0.1.1", | ||
"name": "p5-next", | ||
"version": "0.1.2", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"new:sketch:fullscreen": "npx hygen fullscreen new --name", | ||
"new:sketch:square": "npx hygen square new --name", | ||
"new:sketch:a4": "npx hygen a4 new --name", | ||
"lint": "next lint", | ||
"lint:fix": "next lint --fix" | ||
}, | ||
"dependencies": { | ||
"@chakra-ui/react": "^2.2.1", | ||
"@emotion/react": "^11", | ||
"@emotion/styled": "^11", | ||
"date-fns": "^2.28.0", | ||
"framer-motion": "^6", | ||
"@chakra-ui/react": "^2.3.1", | ||
"@emotion/react": "^11.10.4", | ||
"@emotion/styled": "^11.10.4", | ||
"date-fns": "^2.29.2", | ||
"framer-motion": "^7.2.1", | ||
"fuse.js": "^6.6.2", | ||
"lodash": "^4.17.21", | ||
"next": "12.1.6", | ||
"next": "12.2.5", | ||
"nice-color-palettes": "^3.0.0", | ||
"p5": "^1.4.1", | ||
"p5": "^1.4.2", | ||
"p5.drawer": "^2.0.0", | ||
"p5.js-svg": "^1.3.3", | ||
"react": "18.1.0", | ||
"react-dom": "18.1.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-p5": "^1.3.30" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "17.0.42", | ||
"@types/react": "18.0.12", | ||
"@types/react-dom": "18.0.5", | ||
"eslint": "8.17.0", | ||
"eslint-config-next": "12.1.6", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"typescript": "4.7.3" | ||
"@types/node": "18.7.15", | ||
"@types/react": "18.0.18", | ||
"@types/react-dom": "18.0.6", | ||
"eslint": "8.23.0", | ||
"eslint-config-next": "12.2.5", | ||
"eslint-plugin-simple-import-sort": "^8.0.0", | ||
"typescript": "4.8.2" | ||
} | ||
} |
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
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,93 @@ | ||
import { | ||
Accordion, | ||
AccordionButton, | ||
AccordionIcon, | ||
AccordionItem, | ||
AccordionPanel, | ||
Box, | ||
HStack, | ||
Input, | ||
Slider, | ||
SliderFilledTrack, | ||
SliderThumb, | ||
SliderTrack, | ||
Text, | ||
VStack, | ||
} from '@chakra-ui/react' | ||
import { Dispatch, FC, SetStateAction } from 'react' | ||
|
||
export interface UIValue { | ||
label: string | ||
value: number | ||
setValue: Dispatch<SetStateAction<number>> | ||
max?: number | ||
} | ||
|
||
export interface UIProps { | ||
values: UIValue[] | ||
} | ||
const UI: FC<UIProps> = ({ values }) => { | ||
return ( | ||
<Accordion | ||
position='absolute' | ||
maxW='max-content' | ||
mt={6} | ||
ml={6} | ||
p={3} | ||
bg='white' | ||
borderRadius={8} | ||
borderWidth={1} | ||
borderColor='gray.200' | ||
boxShadow='md' | ||
allowToggle | ||
transition='opacity 200ms ease-out' | ||
> | ||
<AccordionItem border='none'> | ||
<AccordionButton> | ||
<Box flex={1} textAlign='left'> | ||
UI | ||
</Box> | ||
<AccordionIcon /> | ||
</AccordionButton> | ||
<AccordionPanel> | ||
<VStack align='stretch' spacing={6}> | ||
{values.map((v, i) => { | ||
const { label, value, setValue, max } = v | ||
|
||
return ( | ||
<VStack key={i} align='flex-start'> | ||
<HStack> | ||
<Text whiteSpace='nowrap'>{label}:</Text> | ||
<Input | ||
type='number' | ||
value={value} | ||
onChange={e => setValue(parseInt(e.target.value))} | ||
maxW={`${Math.floor(value.toString().length * 2)}ch`} | ||
p={0} | ||
textAlign='center' | ||
/> | ||
</HStack> | ||
<Slider | ||
colorScheme='red' | ||
focusThumbOnChange={false} | ||
defaultValue={value} | ||
value={value} | ||
max={max} | ||
onChange={v => setValue(v)} | ||
> | ||
<SliderTrack> | ||
<SliderFilledTrack /> | ||
</SliderTrack> | ||
<SliderThumb /> | ||
</Slider> | ||
</VStack> | ||
) | ||
})} | ||
</VStack> | ||
</AccordionPanel> | ||
</AccordionItem> | ||
</Accordion> | ||
) | ||
} | ||
|
||
export default UI |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.