Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Sketch Canvas Component#500

Open
lsha0730 wants to merge 7 commits into
devfrom
sketch-canvas-component
Open

Sketch Canvas Component#500
lsha0730 wants to merge 7 commits into
devfrom
sketch-canvas-component

Conversation

@lsha0730

@lsha0730 lsha0730 commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Description

image

  • Made this input component
  • Debounced onChange exports as SVG string by default, possibly base64 if exportAsBase64 prop is true

@lsha0730 lsha0730 requested a review from meleongg July 26, 2023 22:31
@lsha0730 lsha0730 self-assigned this Jul 26, 2023
@github-actions

github-actions Bot commented Jul 26, 2023

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 45dca66):

https://nwplus-ubc--pr500-sketch-canvas-compon-cgz71128.web.app

(expires Thu, 24 Aug 2023 09:25:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 8c7ea898e009e43455645bc310bcbccfc0f87e48

@meleongg meleongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMAZING work Lincoln! SO SPEEDY! I did not know these libraries existed that could do this lol

Your overall approach LGTM, just a couple additional comments:

  • mobile responsiveness -> see ThemeProvider.js for booleans you can use within styled-components
  • I think loading from Firebase would be the next step given that you haven't touched the "value" prop passed from Skills.js -> SketchCanvas.js

Comment thread src/components/ApplicationForm/Skills.js
Comment thread src/components/Input/SketchCanvas.js
<QuestionHeading>question 21</QuestionHeading>
<SubHeading size="1.25em">Draw your favourite character!</SubHeading>
<SketchCanvas
width={600}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is mobile responsive right now. Looking at the npm package, it looks like react-sketch-canvas supports web & mobile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (i think). I didn't touch height cuz I personally think it looks better with the same height across all devices, but lmk if you think otherwise!

Comment thread src/components/Input/SketchCanvas.js
Comment thread src/components/Input/SketchCanvas.js Outdated
const [showPicker, setShowPicker] = useState(false)
const canvasRef = useRef()

const [debounceTimerId, setDebounceTimerId] = useState(null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we could extract the debouncer logic into its own hook to make things cleaner?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see useDebounce in utilities.js w/i this repo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (i think). lmk if you want me to change more things

Comment thread src/components/Input/SketchCanvas.js Outdated
const newTimerId = setTimeout(async () => {
if (!loadedRef.current) return

if (exportAsBase64) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow why we want to save as SVG for the first save and then JPEG for the following saves.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@meleongg meleongg requested a review from DonaldKLee July 29, 2023 09:30

@DonaldKLee DonaldKLee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, great work on this feature! Amazed by how fast you completed it :)

Some notes

  • Clicking on "next" after drawing and then "back" resets the drawing
    • is it possible to render a image onto their canvas? if not, a warning message might be helpful to let users know that they need to restart if they leave the page. Or you can also just display their data64 image below the canvas so applicants know that they did draw something
  • Can we display their drawing on the "Review your submission" page?
  • Not mobile responsive as Melvin mentioned
  • Are we making the drawing required? (leaving canvas empty allows us to move on)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants