reactjs

load local mp4 file as source for video tag in React Gatsby website

岁酱吖の 提交于 2021-02-20 00:23:27
问题 Goal: I'm trying to loop a video infinitely on a React gatsby site. I have a mp4 file locally under assets, but it doesn't show up on my screen. What I've tried: I thought it might be a CSS issue so I set it and it's clearly width and height 100% of the window but video is still not showing up. JS: import React from "react" import "./index.css" export default () => ( <div> <video id="background-video" loop autoPlay> <source src="..\assets\video\Cenote_Squad_Cinemagraph_1500x840_Final.mp4"

load local mp4 file as source for video tag in React Gatsby website

霸气de小男生 提交于 2021-02-20 00:21:19
问题 Goal: I'm trying to loop a video infinitely on a React gatsby site. I have a mp4 file locally under assets, but it doesn't show up on my screen. What I've tried: I thought it might be a CSS issue so I set it and it's clearly width and height 100% of the window but video is still not showing up. JS: import React from "react" import "./index.css" export default () => ( <div> <video id="background-video" loop autoPlay> <source src="..\assets\video\Cenote_Squad_Cinemagraph_1500x840_Final.mp4"

load local mp4 file as source for video tag in React Gatsby website

大兔子大兔子 提交于 2021-02-20 00:21:11
问题 Goal: I'm trying to loop a video infinitely on a React gatsby site. I have a mp4 file locally under assets, but it doesn't show up on my screen. What I've tried: I thought it might be a CSS issue so I set it and it's clearly width and height 100% of the window but video is still not showing up. JS: import React from "react" import "./index.css" export default () => ( <div> <video id="background-video" loop autoPlay> <source src="..\assets\video\Cenote_Squad_Cinemagraph_1500x840_Final.mp4"

How to change header background color in react based on location

社会主义新天地 提交于 2021-02-19 15:51:16
问题 How do I change my headers color based on what route/page I am on in my React project? I have looked at withRouter but I am not sure how to use the example. I just want to do something like if the route is not the Home component then change the background color of the header to blue. Seems like it would be simple but can't figure it out. 回答1: You can use the location prop that is added to your component by connecting the component to the router via withRouter . From there you apply a

How to change header background color in react based on location

让人想犯罪 __ 提交于 2021-02-19 15:50:13
问题 How do I change my headers color based on what route/page I am on in my React project? I have looked at withRouter but I am not sure how to use the example. I just want to do something like if the route is not the Home component then change the background color of the header to blue. Seems like it would be simple but can't figure it out. 回答1: You can use the location prop that is added to your component by connecting the component to the router via withRouter . From there you apply a

How to use custom 'editComponent' in material-table?

若如初见. 提交于 2021-02-19 10:38:54
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

How to use custom 'editComponent' in material-table?

六眼飞鱼酱① 提交于 2021-02-19 10:38:24
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

How to use custom 'editComponent' in material-table?

只愿长相守 提交于 2021-02-19 10:37:13
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

Fetch image in React from Node.js request

帅比萌擦擦* 提交于 2021-02-19 08:56:14
问题 When needed, React asks for an image using Superagent : exports.getImgFromSection=function(id,request){ request .get('/img/'+id) .end((error, response) => { if (!error && response) { console.log(response.file); } else { console.log('There was an error fetching server', error); } }) } Node.js answers this way : app.get("/img/:id",function(req, res){ // check if exists and then res.sendFile(path.join(__dirname, './data/img/'+req.params['id']+'.png')); }); But I don't know how to get the image

Gatsby JS: Preloader is loading forever

女生的网名这么多〃 提交于 2021-02-19 08:43:10
问题 I copied a simple full page preloader via jQuery on my Gatsby app. The preloader works however instead of disappearing after 4 seconds its loading forever on production but on local it works just fine. Here's my Preloader component: import React from 'react' const Preloader = () => { return ( <div id="loader-wrapper"> <div id="loader"></div> <div className="loader-section section-left"></div> <div className="loader-section section-right"></div> </div> ) } export default Preloader And then on