I have written a Portfolio.js file using react library react-bootstrap Carousel.js to create an uncontrolled carousel. My code displays the slides in vertical instead of switching as Carousel, https://react-bootstrap.github.io/components/carousel/. My carousel behavior does not work
Posting the code below: https://codesandbox.io/s/stoic-beaver-6j1ie?file=/src/component/Project.js
import React, { Component } from "react";
import TextBlock from "./TextBlock";
import "../styles/Styles.css";
import { Row, Col, Carousel } from "react-bootstrap";
import ModalItem from "./ModalItem.js";
import model from "../assets/img/portfolio/3d-tool.PNG";
import portfolio from "../assets/img/portfolio/download.svg";
import americanDream from "../assets/img/portfolio/download.jpg";
import PrevButton from "../assets/img/PrevButton.svg";
import NextButton from "../assets/img/NextButton.svg";
import features from "../assets/img/portfolio/model.gif";
import photo from "../assets/img/portfolio/portfolio.gif";
import styled from "styled-components";
// import 'bootstrap/dist/css/bootstrap.min.css';
const StyledCarousel = styled(Carousel)`
.carousel-control-prev-icon {
background-image: url(${PrevButton});
}
.carousel-control-next-icon {
background-image: url(${NextButton});
}
.carousel-control-prev-icon,
.carousel-control-next-icon {
width: 2em;
height: 2em;
}
.carousel-control-next,
.carousel-control-prev {
top: 40%;
bottom: auto;
z-index: 20;
}
`;
class Portfolios extends Component {
state = {
modals: [
{
id: 1,
open: false
},
{
id: 2,
open: false
},
{
id: 3,
open: false
}
]
};
onOpenModal = (id) => {
this.setState({
modals: this.state.modals.map((item) => {
if (item.id === id) {
item.open = true;
}
return item;
})
});
};
onCloseModal = (id) => {
this.setState({
modals: this.state.modals.map((item) => {
if (item.id === id) {
item.open = false;
}
return item;
})
});
};
getOpen = (id) => {
const open = this.state.modals;
return open[id - 1].open;
};
render() {
return (
<section id="portfolio">
<div className="content">
<h2>MY PROJECTS</h2>
<div id="Projects" className="Projects">
<Row className="no-gutters" data-aos="fade-up" data-aos-delay="100">
<Col sm={12}>
<TextBlock title="Go over some projects I have worked on">
<div style={{ paddingTop: "0.5em" }}>
<Carousel>
<Carousel.Item>
<img
className="d-block"
src={model}
width="70%"
alt="First slide"
/>
<Carousel.Caption>
<h3>3D Construction Tool</h3>
<p>
A React website to render 3D model in astronomy,
built with React front-end, Node server, WebGL,
Google Cloud Platform and Neural Network
<br />
<button
className="Styled-Button"
onClick={() => {
this.onOpenModal(1);
}}
>
Details
</button>
<a
className="Styled-Button"
href="https://github.com/tuyenphk/3D-RECONSTRUCTION-TOOL"
target="_blank"
rel="noopener noreferrer"
>
Code
</a>
</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img
className="d-block"
src={portfolio}
width="70%"
alt="Third slide"
/>
<Carousel.Caption>
<h3>Portfolio Website</h3>
<p>
My personal portfolio responsive website, built with
React to let viewers get to know a little bit more
about me, my projects and my designs
<br />
<button
className="Styled-Button"
onClick={() => {
this.onOpenModal(2);
}}
>
Details
</button>
<a
className="Styled-Button"
href="https://github.com/tuyenphk/porfolio-website"
target="_blank"
rel="noopener noreferrer"
>
Code
</a>
</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img
className="d-block"
src={americanDream}
width="70%"
alt="Third slide"
/>
<Carousel.Caption>
<h3>American Dream</h3>
<p>
My first web application project
<br />
<a
className="Styled-Button"
href="http://cis-linux2.temple.edu:8080/SP20_3308_tuh39709/#/home"
target="_blank"
rel="noopener noreferrer"
>
Live
</a>
<a
className="Styled-Button"
href="https://github.com/tuyenphk/Pham_web"
target="_blank"
rel="noopener noreferrer"
>
Code
</a>
</p>
</Carousel.Caption>
</Carousel.Item>
</Carousel>
<ModalItem
isOpen={this.getOpen(1)}
onClose={() => {
this.onCloseModal(1);
}}
>
<TextBlock title="3D Reconstruction Tool">
<Row className="no-gutters">
<Col md={7}>
<p>
3D-Reconstruction Tool is a fun, enjoyable, and
informative web application designed for
experimentation, research, and casual learning.
The application's cloud-hosted neural network
offers symmetry detection services for
2-dimensional astronomy images, and reproduces
them in a 3-dimensional format. Cloud-based
machine learning has rapidly evolved into a vital
and sophisticated aspect of modern software
development. The goal of the 3D Reconstruction
Tool aims to explore and transform these
components into an entertaining, informative
platform.
</p>
</Col>
<Col md={5}>
<figure
style={{ maxWidth: "280px", textAlign: "center" }}
>
<img
src={features}
alt="3d demo"
style={{ maxWidth: "100%", height: "auto" }}
></img>
<figcaption style={{ textAlign: "center" }}>
<i>3D Reconstruction Tool's chatbot feature</i>
</figcaption>
</figure>
</Col>
</Row>
<Row>
<Col>
<h2>
<b>
Features: Web application is built by React
Hook, instantiated Nodejs, serviced on Google
Compute Engine with some features
</b>
</h2>
<ul
style={{
paddingLeft: "1.1em",
textAlign: "left"
}}
>
<li>
There are 4 tabs: Home, Modelling, Resource,
Team to navigate.
</li>
<li>
Upload functionality & sent to Google Cloud
Storage bucket.
</li>
<li>Render button for modelling 3D model.</li>
<li>
Utilize the ‘Search’ functions to find 2D
images.
</li>
<li>
Ability to search, obtain, and display their
rendered images
</li>
</ul>
<h2>
<b>Technologies used:</b>
</h2>
<p>
React, React Hook, WebGL, Three.js, Node, Express,
Google Cloud Platform, Neraul-Network
</p>
<p>
<em>
Special thanks to my collaborators: Khai Nguyen,
Elizaveta Lizaibeme, and Lauren Kimpel from
Temple University's Class of 2020!
</em>
</p>
</Col>
</Row>
</TextBlock>
</ModalItem>
<ModalItem
isOpen={this.getOpen(2)}
onClose={() => {
this.onCloseModal(2);
}}
>
<TextBlock title="Portfolio Website">
<Row className="no-gutters">
<Col md={7}>
<p>
My personal portfolio responsive website, built
with React to showcase my projects, my photoshop
designs and let viewers get to know a little bit
more about me.
</p>
</Col>
<Col md={5}>
<figure
style={{ maxWidth: "280px", textAlign: "center" }}
>
<img
src={photo}
alt="3d demo"
style={{ maxWidth: "100%", height: "auto" }}
></img>
<figcaption style={{ textAlign: "center" }}>
<i>Portfolio's chatbot feature</i>
</figcaption>
</figure>
</Col>
</Row>
<Row>
<Col>
<h2>
<b>Features:</b>
</h2>
<ul
style={{
paddingLeft: "1.1em",
textAlign: "left"
}}
>
<li>Display the home page.</li>
<li>
Describe about myself to let employers
understand me.
</li>
<li>
More details about projects I have worked on.
</li>
<li>
Display some designs I have experienced in
Illustrator, Photoshop, and Indesign.
</li>
<li>
A contact form for employers get in touch with
me.
</li>
</ul>
<h2>
<b>Technologies used:</b>
</h2>
<p>React, Firebase-hosting, Formspree</p>
</Col>
</Row>
</TextBlock>
</ModalItem>
</div>
</TextBlock>
</Col>
</Row>
</div>
</div>
</section>
);
}
}
export default Portfolios;
Can someone spend your time to help me with this? I have really appreciated it!
I found my answer here
add this to index.html under public folder (for react app)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
Related
So I'm using react-bootstrap to create my Navbar and I want the Navbar link to redirect to the same page but to the spesific part, I tried using href and assigning id into each div, but it wont' work. How to fix this ? Thanks before
Here's my code:
Navbar part
<Navbar className="MainHeader" expand="lg">
<Navbar.Brand as={Link} to={"/"}>
<img src="#" className='encotekiLogo' alt="main_logo"/>
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse className="justify-content-end">
<Nav>
<Nav.Link as={Link} href='about' to={'/#about'}>About</Nav.Link>
<Nav.Link as={Link} to={"/Gallery"}>Gallery</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>
This is the code for my part of the page:
<div className= 'aboutUs' id='about'>
<Row className='mb-4' lg={12}>
<h1 style={{
color: '#246234',
}}>
About<br/>
Us
</h1>
</Row>
</div>
I m trying to get product listing specific detail, while I click on the item from the listing page.
I used the react-router-dom navLink approach but failed. kindly guide how can I achieve with or without react-router. "listing to detail" how can I send the whole specific props from listing to detail components
product-listing.js component
<section className='product-listing-sec'>
<div className='container p-0'>
<div className='row'>
<div className='col-12'>
<h1>Category name</h1>
</div>
{/* product card list */}
{/* <ProductCard /> */}
{
data.products.map(prod=>{
return(
<div className='col-12 col-md-6 col-lg-4 col-xl-4' key={prod.title}>
<div className={`product-card ${prod.itemQuantity === 0 ? 'out-stock': ''}`}>
<Link to={{ pathname: `/product-discription`, state:{data:prod.title} }} className='img-wrap'>
<h5>Out of stock</h5>
<img src={prod.image} alt='product image' className='img-fluid' />
<div className='cartbtn'>
<img src={Cartlg} alt='cart' />
</div>
</Link>
<div className='card-detail'>
<p className='title'> {prod.title} </p>
<p className='price'>$ {prod.price} </p>
</div>
</div>
</div>
)
})
}
</div>
</div>
</section>
Product-detail.js page
export const ProductDiscription = (props)=> {
const { data } = props.location
console.log("data :"+ data)
return (<> <div> {data} </div> </>)
}
I am working on page layout using react-bootstrap. Along with that, I am using pure CSS for it. I have an alignment issue for Navbar on desktop view and mobile view. The components in the top bar should align with the components in the bottom bar in medium & large devices. The layout is different on the mobile device. In large devices Nav toggle bar expands and shrinks in the mobile devices when the user clicks on the toggle bar in the mobile screen, it expands down as shown in the figure. I hope the problem is clear. I have added the code and sample of the layout. Can someone help me to solve this issue?
CODE
<Container noGutters>
<Row className='main-nav d-flex' style={{ alignItems: 'center', justifyContent: 'flex-start' }}>
<Col sm={12} md={4} style={{ textAlign: 'center' }}>
<a href='/'>
visit mysite.com
</a>
</Col>
<Col sm={12} md={4} style={{ textAlign: 'center' }}>
<a href='#about-us'>
<picture>
<source srcSet={require('../public/assets/_logo.png?webp')} type='image/webp' />
<img className='cure-top-logo' src={'/assets/logo.png'} />
</picture>
</a>
</Col>
<Col sm={12} md={4}>
<Dropdown className='top-dropdown-container'>
<Dropdown.Toggle variant='success' id='dropdown'>
Choose an Item
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item href='/'>ITEM 1</Dropdown.Item>
<Dropdown.Item href='/'>ITEM 2</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</Col>
</Row>
</Container>
<Navbar style={{ maxHeight: '90px' }} className='sole-bottom-nav' expand={'lg'}>
<Container>
<div className='bottom-nav-logo-container'>
<a href='/cure-adventures/sole2soul'>
<div className='bottom-logo'>
<img alt='' src='assets/header.png' />
</div>
</a>
</div>
<Navbar.Toggle aria-controls='navlinks' />
<Navbar.Collapse id='navlinks'>
<Nav>
<Nav.Link className={activePage === 'about-us' ? ' active' : ''} href='/about-us'>
About Us
</Nav.Link>
<Nav.Link className={activePage === 'treks' ? ' active' : ''} href='/news'>
News
</Nav.Link>
<Nav.Link className={activePage === 'news' ? ' active' : ''} href='/contact'>
Contact us
</Nav.Link>
</Nav>
<div>
<a rel='noopener nofollow' target='_blank' href='https://twitter.com'>
<img src='/assets/twitter.png' width='25px' />
</a>
<a rel='noopener nofollow' target='_blank' href='https://facebook.com'>
<img src='/assets/facebook.png' width='25px' />
</a>
<a rel='noopener nofollow' target='_blank' href='https://instagram.com'>
<img src='/assets/instagram.png' width='25px' />
</a>
<a rel='noopener nofollow' target='_blank' href='/'>
<img src='/assets/linkdin.png' width='25px' />
</a>
</div>
<div>
<Button size={'lg'}>
button
</Button>
</div>
</Navbar.Collapse>
</Container>
</Navbar>
</div>
Hi guys so I'm trying to create some website using react-bootstrap and I wanted to redirect my user to another website/link when they click on some logo on my footer, How can I do that in react ? because I realize that tag will only redirect the path of our website.
Here's my code:
import { Container, Row, Col } from "react-bootstrap"
import '../CSS/Footer.css'
const Footer = () => {
return (
<Container fluid={true} className="p-0 footerContainer">
<Row>
<Col sm={12} lg={4} className="text-center footerright">
<h3>Follow Us</h3>
<hr style={{border:'2px solid', color:'#FFFFFF', width:'25.7%', margin: 'auto'}}></hr>
<img src="FBLogo.jpg"></img>
<img src="IGLogo.jpg"></img>
</Col>
</Row>
<Row>
<Col sm={12} lg={12} className="text-center">
<hr></hr>
<p>Copyright © 2014 <br></br>All Rights Reserved</p>
</Col>
</Row>
</Container>
)
}
export default Footer
Just like in normal HTML, You will wrap an image with a link tag:
<img src="FBLogo.jpg"/>
<img src="IGLogo.jpg"/>
Or using a workmap:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Stack_Overflow_icon.svg/768px-Stack_Overflow_icon.svg.png" alt="Workplace" usemap="#workmap" width="400" height="379">
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="stack_overflow" href="https://www.google.com/">
</map>
I have a main element which is divided into a grid of 3 columns.
in the middle column I am displaying some listings.
each listing is a div element and has a react bootstrap card inside it.
I am trying to get the card to span 100% of the parent but that doesn't seem to be working for me.
React component
<div className="backfill">
<Row key={Listing_Id}>
<Card style={{ cursor: 'pointer' }} border="light" className="text-center fullCard" >
<Card.Body>
<Card.Title className="Title">
{Listing_Name}
<hr />
<Button className="Button" variant="outline-success" onClick={() => props.handleLikeDisLike(Listing_Id, 'Listing_Likes', Listing_Location)}> <Twemoji options={options} text=":+1:" /></Button>
<Badge className="Badge" variant="light">{Listing_Likes}</Badge>
<Button className="Button" variant="outline-danger" onClick={() => props.handleLikeDisLike(Listing_Id, 'Listing_DisLikes', Listing_Location)}><Twemoji options={options} text=":-1:" /></Button>
<Badge className="Badge" variant="light">{Listing_DisLikes}</Badge>
<hr />
<Button className="Button" variant="outline-info" ><Twemoji text=":pushpin:" /></Button>
<Badge className="Badge" variant="light">{Listing_Location}</Badge>
</Card.Title>
<Card.Text className="Listing" onClick={() => handleClick(Listing_Id)} >
<hr />
{ListingBody}
<ModalLayout
Listing_Location={Listing_Location}
Listing_Likes={Listing_Likes}
Listing_DisLikes={Listing_DisLikes}
Listing_Name={Listing_Name}
Listing_Id={Listing_Id}
handleLikeDisLike={props.handleLikeDisLike}
handleClose={closeModal}
show={showModal} />
</Card.Text>
</Card.Body>
</Card>
</Row>
<br />
</div >
CSS for div and Card elements
.backfill {
background-color: aqua;
}
.fullCard {
width:'100%';
}
I currently end up with the UI looking like this. Please can you help me sort this out. I want to get the card to be 100% of its parent div.
Just had to remove the single quotes from the CSS
.fullCard {
width:'100%';
}
had to become
.fullCard {
width:100%;
}