Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meme Maker -- didn't get it to work #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sambernaldamasco
Copy link

No description provided.

@sambernaldamasco
Copy link
Author

I didn't host it anywhere, so here's a video of it kinda working

@derekjj
Copy link
Contributor

derekjj commented Apr 24, 2020

Suggest upload the site and/or video in the future. If you would like help with this... I can help you out :)

@@ -0,0 +1,44 @@
import React, { useState } from 'react';
import logo from './logo.svg';

Choose a reason for hiding this comment

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

If you are not using the logo, it is better to clean everything you do not need before starting work

import ImageEditor from './components/ImageEditor';

function App() {
const [imgURL, setImgURL] = useState(null);

Choose a reason for hiding this comment

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

No need to add "null" you can leave the useState empty

const [imgURL, setImgURL] = useState(null);
const [uploaded, setUploaded] = useState(false);

const handleUpload = (event) => {

Choose a reason for hiding this comment

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

pYou could deconstruct the event earlier, to make it more readable and easy to work with the const handleUpload = ({target: {files}) => {

Here more info: https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Operadores/Destructuring_assignment


const handleUpload = (event) => {
setImgURL(URL.createObjectURL(event.target.files[0]));
console.log(event.target.files[0]);

Choose a reason for hiding this comment

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

You can delete the console.log once you have finished developing

};

const fileUploader = (
<div class="file">

Choose a reason for hiding this comment

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

Although it allows you to use "class" it recommends you and you should always use "className" to avoid mistakes and to respect the recommendations that React makes you

more info here: facebook/react#13525 (comment)

<input
type="file"
className="file-input"
onChange={(event) => handleUpload(event)}

Choose a reason for hiding this comment

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

If you don't activate the function you don't need to add an anonymous function. This way it is cleaner:

onChange={handleUpload}

Copy link

@agarci1994 agarci1994 left a comment

Choose a reason for hiding this comment

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

Good work!

@@ -0,0 +1,118 @@
import React, { useState } from 'react';
const ImageEditor = (props) => {

Choose a reason for hiding this comment

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

Here you can destructuring props

const convertToImage = () => {
//getting the SVG data
const svg = document.querySelector('svg');
let xml = new XMLSerializer().serializeToString(svg);

Choose a reason for hiding this comment

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

i think that here you can use "const"

dominantBaseline="middle"
style={textStyle}
>
{topText}

Choose a reason for hiding this comment

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

Can you add "topTex" in tag HTML

className="input"
type="text"
value={topText}
onChange={(e) => setTopText(e.target.value)}

Choose a reason for hiding this comment

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

In the arrow function if you only have one argument, you don't need to put it in parentheses

@agarci1994
Copy link

The application looks very good, the code is quite readable and I have not found any major flaw. Congratulations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants