This file contains hidden or 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
| { | |
| "name": "parcel-example", | |
| ... | |
| "scripts": { | |
| "serve": "parcel serve src/index.html", | |
| "build": "parcel build --no-source-maps src/index.html" | |
| }, | |
| ... | |
| } |
This file contains hidden or 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
| import { btnEvent } from './Button'; | |
| document | |
| .getElementById('btn') | |
| .addEventListener('click', btnEvent); |
This file contains hidden or 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
| h1 { | |
| font-family: Arial, Helvetica, sans-serif; | |
| margin-top: 50px; | |
| } |
This file contains hidden or 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
| { | |
| "name": "parcel-example", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "serve": "parcel serve src/index.html" | |
| }, | |
| "keywords": [], | |
| "author": "", |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ParcelJS</title> | |
| <link rel="stylesheet" href="scss/styles.scss"> | |
| </head> | |
| <body> | |
| <h1>Hello from Parcel!</h1> |
This file contains hidden or 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
| import React, { useState, useEffect } from 'react'; | |
| import { Search } from './Search'; | |
| import { Video } from './Video'; | |
| export function App() { | |
| const [currentChannelId, setCurrentChannelId] = useState(); | |
| const [videos, setVideos] = useState([]); | |
| const baseUrl = 'https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.youtube.com%2Ffeeds%2Fvideos.xml%3Fchannel_id%3D'; |
This file contains hidden or 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
| import React from 'react'; | |
| export const Video = props => ( | |
| <div className="videos__item"> | |
| <div className="video__image"> | |
| <a target="_blank" href={props.video.link}> | |
| <img src={`https://i4.ytimg.com/vi/${props.video.guid.split(':')[2]}/mqdefault.jpg`} /> | |
| </a> | |
| </div> | |
| <div className="video__footer"> |
This file contains hidden or 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
| import React, { useState, useEffect } from 'react'; | |
| import { Search } from './Search'; | |
| export function App() { | |
| const [currentChannelId, setCurrentChannelId] = useState(); | |
| return ( | |
| <div className="app-container"> | |
| <h1>Latest YouTube Videos</h1> | |
| <Search setCurrentChannelId={id => setCurrentChannelId(id)}/> |
This file contains hidden or 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
| import React, { useState } from 'react'; | |
| export const Search = props => { | |
| const [channelId, setChannelId] = useState(''); | |
| return ( | |
| <div> | |
| <div className="search"> | |
| <input type="text" onChange={event => setChannelId(event.target.value)} placeholder="Enter your favourite channel ID" /> | |
| <button disabled={!channelId.length} onClick={() => props.setCurrentChannelId(channelId)}>Get videos</button> | |
| </div> |