tosanoob commited on
Commit
22c310d
·
1 Parent(s): b09620e

Update: finish homepage

Browse files
frontend/public/placeholder2.jpg ADDED
frontend/public/placeholder3.jpg ADDED
frontend/public/placeholder4.jpg ADDED
frontend/src/molecules/AboutUsSection.js CHANGED
@@ -2,7 +2,7 @@ import { Container, Row, Col } from "react-bootstrap";
2
 
3
  export default function AboutUsSection () {
4
  return (<>
5
- <Container>
6
  <h1 className="my-4">CATS Shop
7
  <small> - We code for fun </small>
8
  </h1>
 
2
 
3
  export default function AboutUsSection () {
4
  return (<>
5
+ <Container id="about-us">
6
  <h1 className="my-4">CATS Shop
7
  <small> - We code for fun </small>
8
  </h1>
frontend/src/molecules/ContactSection.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Container, Row, Col } from "react-bootstrap";
2
+
3
+ export default function ContactSection() {
4
+ return (
5
+ <Container id="contact" className="align-items-center">
6
+ <h1>Thông tin liên hệ</h1>
7
+ <Row md={3}>
8
+ {/* Cột 1: Số điện thoại liên hệ */}
9
+ <Col>
10
+ <h5>Liên hệ</h5>
11
+ <p>Số điện thoại: 0123-456-789</p>
12
+ </Col>
13
+
14
+ {/* Cột 2: Số đăng ký kinh doanh */}
15
+ <Col>
16
+ <h5>Thông tin công ty</h5>
17
+ <p>Số ĐKKD: 123456789</p>
18
+ </Col>
19
+
20
+ {/* Cột 3: Fanpage link */}
21
+ <Col>
22
+ <h5>Fanpage</h5>
23
+ <p>
24
+ <a href="https://www.facebook.com/" target="_blank" rel="noreferrer">
25
+ Facebook
26
+ </a>
27
+ </p>
28
+ </Col>
29
+ </Row>
30
+ </Container>
31
+ );
32
+ }
frontend/src/molecules/MenuItem.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // a card item represent a news in newsSection
2
+ import { Card } from "react-bootstrap";
3
+
4
+ export default function MenuItem( {dishName, description, imageSrc} ) {
5
+ return (
6
+ <Card className="align-items-center">
7
+ <Card.Img variant="top" src={imageSrc}/>
8
+ <Card.Body>
9
+ <Card.Title>{dishName}</Card.Title>
10
+ <Card.Text>
11
+ {description}
12
+ </Card.Text>
13
+ </Card.Body>
14
+ </Card>
15
+ );
16
+ }
frontend/src/molecules/Navbar.js CHANGED
@@ -34,7 +34,7 @@ export default function ANavbar( {isLoggedIn = false, user} ) {
34
  }
35
 
36
  return (
37
- <Navbar expand="lg" className="bg-body-tertiary">
38
  <Container>
39
  <Navbar.Brand href="/">
40
  <img
 
34
  }
35
 
36
  return (
37
+ <Navbar expand="lg" className="bg-body-tertiary" sticky='top' >
38
  <Container>
39
  <Navbar.Brand href="/">
40
  <img
frontend/src/molecules/StoreItem.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // a card item represent a news in newsSection
2
+ import { Card } from "react-bootstrap";
3
+
4
+ export default function StoreItem( {storeName, address, imageSrc} ) {
5
+ return (
6
+ <Card className="align-items-center">
7
+ <Card.Img variant="top" src={imageSrc}/>
8
+ <Card.Body>
9
+ <Card.Title>{storeName}</Card.Title>
10
+ <Card.Text>
11
+ {address}
12
+ </Card.Text>
13
+ </Card.Body>
14
+ </Card>
15
+ );
16
+ }
frontend/src/organisms/MenuSection.js CHANGED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+ import { Container, Carousel, Row, Col } from 'react-bootstrap';
3
+ import MenuItem from '../molecules/MenuItem';
4
+
5
+ function MenuSection() {
6
+ const [index, setIndex] = useState(0);
7
+
8
+ const handleSelect = (selectedIndex) => {
9
+ setIndex(selectedIndex);
10
+ };
11
+
12
+ const menuItems = [
13
+ { name: 'Món 1', description: 'Mô tả món 1', imageSrc: '/placeholder3.jpg' },
14
+ { name: 'Món 2', description: 'Mô tả món 2', imageSrc: '/placeholder3.jpg' },
15
+ { name: 'Món 3', description: 'Mô tả món 3', imageSrc: '/placeholder3.jpg' }
16
+ ];
17
+
18
+ const countCarouselSlides = 4;
19
+
20
+ return (
21
+ <Container id="menu" className="text-center justify-content-center align-items-center">
22
+ <h1>Menu</h1>
23
+ <Carousel activeIndex={index} onSelect={handleSelect} data-bs-theme="dark">
24
+ {Array.from({ length: countCarouselSlides }).map((_, slideIndex) => (
25
+ <Carousel.Item key={slideIndex}>
26
+ <div className="d-flex justify-content-center align-items-center" style={{ width: '100%' }}>
27
+ <img
28
+ className="img-fluid"
29
+ src="/placeholder4.jpg"
30
+ alt="a placeholder"
31
+ style={{ maxHeight: '100%', maxWidth: '100%', objectFit: 'contain' }}
32
+ />
33
+ </div>
34
+
35
+ <Carousel.Caption>
36
+ <div >
37
+ <Row md={3} className="g-4">
38
+ {menuItems.map((item, idx) => (
39
+ <Col key={idx}>
40
+ <MenuItem
41
+ dishName={item.name}
42
+ description={item.description}
43
+ imageSrc={item.imageSrc}
44
+ />
45
+ </Col>
46
+ ))}
47
+ </Row>
48
+ </div>
49
+ </Carousel.Caption>
50
+ </Carousel.Item>
51
+ ))}
52
+ </Carousel>
53
+ </Container>
54
+ );
55
+ }
56
+
57
+ export default MenuSection;
frontend/src/organisms/NewsSection.js CHANGED
@@ -3,7 +3,7 @@ import NewsItem from '../molecules/NewsItem';
3
 
4
  function NewsSection( {newsFeeds} ) {
5
  return (
6
- <Container className="text-center justify-content-center align-items-center">
7
  <h1>Tin tức</h1>
8
  <Row xs={1} md={2} xl={3} className="g-4">
9
  {Array.from(newsFeeds).map((feed, idx) => (
 
3
 
4
  function NewsSection( {newsFeeds} ) {
5
  return (
6
+ <Container id="news" className="text-center justify-content-center align-items-center">
7
  <h1>Tin tức</h1>
8
  <Row xs={1} md={2} xl={3} className="g-4">
9
  {Array.from(newsFeeds).map((feed, idx) => (
frontend/src/organisms/StoreSection.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Container, Col, Row } from 'react-bootstrap';
2
+ import StoreItem from '../molecules/StoreItem';
3
+
4
+ function StoreSection({ stores }) {
5
+ return (
6
+ <Container id="store" className="text-center justify-content-center align-items-center">
7
+ <h1>Các chi nhánh</h1>
8
+ <Row className="align-items-center">
9
+ <Col xs={12} md={4} className="d-flex justify-content-center align-items-center">
10
+ Đây là các chi nhánh đang mở, chưa mở, sắp mở và có thể là sẽ không mở
11
+ </Col>
12
+
13
+ <Col xs={12} md={8}>
14
+ <Container>
15
+ <Row xs={1} md={2} xl={3} className="g-4">
16
+ {Array.from(stores).map((store, idx) => (
17
+ <Col key={idx}>
18
+ <StoreItem storeName={store.storeName}
19
+ address={store.address}
20
+ imageSrc={store.imageSrc}>
21
+ </StoreItem>
22
+ </Col>
23
+ ))}
24
+ </Row>
25
+ </Container>
26
+ </Col>
27
+ </Row>
28
+ </Container>
29
+ );
30
+ }
31
+
32
+ export default StoreSection;
frontend/src/organisms/StoresSection.js DELETED
File without changes
frontend/src/pages/HomePage.js CHANGED
@@ -3,6 +3,9 @@
3
  import ANavbar from '../molecules/Navbar';
4
  import AboutUsSection from '../molecules/AboutUsSection';
5
  import NewsSection from '../organisms/NewsSection';
 
 
 
6
 
7
  function HomePage () {
8
  // const [isLoggedIn, setIsLoggedIn] = useState(false);
@@ -13,19 +16,25 @@ function HomePage () {
13
  { title: 'Feed 2', text: 'This is the second feed', imageSrc: '/placeholder1.jpg', feedHref: '' },
14
  { title: 'Feed 3', text: 'This is the third feed', imageSrc: '/placeholder1.jpg', feedHref: ''}
15
  ];
16
- // const stores = [{ name: 'Store 1', address: 'Address 1' }, { name: 'Store 2', address: 'Address 2' }];
17
- // const menuItems = [
18
- // { name: 'Món 1', description: ' tả món 1', price: '100.000 VND' },
19
- // { name: 'Món 2', description: ' tả món 2', price: '150.000 VND' },
20
- // { name: 'Món 3', description: 'Mô tả món 3', price: '200.000 VND' }
21
- // ];
22
 
23
  return (
24
  <>
25
- <ANavbar></ANavbar>
26
- <AboutUsSection id="about-us"></AboutUsSection>
 
 
 
 
 
 
27
  <br></br>
28
- <NewsSection id="news" newsFeeds={newsFeeds}></NewsSection>
29
  </>
30
  );
31
  };
 
3
  import ANavbar from '../molecules/Navbar';
4
  import AboutUsSection from '../molecules/AboutUsSection';
5
  import NewsSection from '../organisms/NewsSection';
6
+ import StoreSection from '../organisms/StoreSection';
7
+ import MenuSection from '../organisms/MenuSection';
8
+ import ContactSection from '../molecules/ContactSection';
9
 
10
  function HomePage () {
11
  // const [isLoggedIn, setIsLoggedIn] = useState(false);
 
16
  { title: 'Feed 2', text: 'This is the second feed', imageSrc: '/placeholder1.jpg', feedHref: '' },
17
  { title: 'Feed 3', text: 'This is the third feed', imageSrc: '/placeholder1.jpg', feedHref: ''}
18
  ];
19
+ const stores = [
20
+ { storeName: 'Store 1', address: 'Address 1', imageSrc: '/placeholder2.jpg' },
21
+ { storeName: 'Store 2', address: 'Address 2', imageSrc: '/placeholder2.jpg' },
22
+ { storeName: 'Store 3', address: 'Address 3', imageSrc: '/placeholder2.jpg' },
23
+ ];
24
+
25
 
26
  return (
27
  <>
28
+ <ANavbar id="home"></ANavbar>
29
+ <AboutUsSection></AboutUsSection>
30
+ <br></br>
31
+ <NewsSection newsFeeds={newsFeeds}></NewsSection>
32
+ <br></br>
33
+ <StoreSection stores={stores}></StoreSection>
34
+ <br></br>
35
+ <MenuSection></MenuSection>
36
  <br></br>
37
+ <ContactSection></ContactSection>
38
  </>
39
  );
40
  };