Skip to content

Commit

Permalink
Add media page with grid layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromehardaway committed May 21, 2024
1 parent 1925fdc commit b61031f
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 102 deletions.
37 changes: 37 additions & 0 deletions src/components/media-grid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import PropTypes from 'prop-types';

const MediaGrid = ({ section, data }) => {
return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{data.map((item, index) => (
<div key={index} className="max-w-sm rounded overflow-hidden shadow-lg">
<img className="w-full" src={item.image} alt={item.title} />
<div className="px-6 py-4">
<div className="font-bold text-xl mb-2">{item.title}</div>
<p className="text-gray-700 text-base">
{item.description}
</p>
</div>
<div className="px-6 pt-4 pb-2">
{item.tags.map((tag, index) => (
<span key={index} className="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">#{tag}</span>
))}
</div>
</div>
))}
</div>
);
};

MediaGrid.propTypes = {
section: PropTypes.string.isRequired,
data: PropTypes.arrayOf(PropTypes.shape({
image: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string,
tags: PropTypes.arrayOf(PropTypes.string),
})).isRequired,
};

export default MediaGrid;
26 changes: 22 additions & 4 deletions src/components/ui/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ interface ButtonProps {
/**
* Optional. Default is `contained`.
*/
variant?: "contained" | "outlined" | "texted";
variant?: "contained" | "outlined" | "texted" | "media";
/**
* Optional. Default is `primary`.
*/
color?: "primary" | "light";
color?: "primary" | "light" | "media";
/**
* Optional. Default is `md`.
*/
Expand Down Expand Up @@ -164,6 +164,24 @@ const Button = ({
lightHoverClass,
];

// Media Button
const mediaClass = "tw-bg-media tw-border-media tw-text-white";
const mediaHoverClass =
!disabled &&
!active &&
hover === "default" &&
"hover:tw-bg-media-dark hover:tw-border-media-dark hover:tw-text-white";
const mediaActiveClass =
!disabled &&
active &&
"tw-bg-media-dark tw-border-media-dark active:tw-bg-media-dark active:tw-border-media-dark";
const mediaBtn = color === "media" && [
mediaClass,
mediaHoverClass,
mediaActiveClass,
lightHoverClass,
];

// Buton Sizes
const mdBtn =
size === "md" &&
Expand All @@ -179,8 +197,8 @@ const Button = ({
const classnames = clsx(
variant !== "texted" && baseClass,
variant !== "texted" && baseNotFullWidthClass,
variant === "contained" && [containedPrimaryBtn, containedLightBtn],
variant === "outlined" && [outlinedPrimaryBtn, outlinedLightBtn],
variant === "contained" && [containedPrimaryBtn, containedLightBtn, mediaBtn],
variant === "outlined" && [outlinedPrimaryBtn, outlinedLightBtn, mediaBtn],
!iconButton && variant !== "texted" && [mdBtn, xsBtn],
roundedBtn,
ellipseBtn,
Expand Down
64 changes: 64 additions & 0 deletions src/data/media.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"media": [
{
"section": "What we have built",
"items": [
{
"title": "Project 1",
"description": "Description of Project 1",
"link": "https://example.com/project1"
},
{
"title": "Project 2",
"description": "Description of Project 2",
"link": "https://example.com/project2"
}
]
},
{
"section": "Publications",
"items": [
{
"title": "Publication 1",
"description": "Description of Publication 1",
"link": "https://example.com/publication1"
},
{
"title": "Publication 2",
"description": "Description of Publication 2",
"link": "https://example.com/publication2"
}
]
},
{
"section": "Podcasts",
"items": [
{
"title": "Podcast 1",
"description": "Description of Podcast 1",
"link": "https://example.com/podcast1"
},
{
"title": "Podcast 2",
"description": "Description of Podcast 2",
"link": "https://example.com/podcast2"
}
]
},
{
"section": "Courses",
"items": [
{
"title": "Course 1",
"description": "Description of Course 1",
"link": "https://example.com/course1"
},
{
"title": "Course 2",
"description": "Description of Course 2",
"link": "https://example.com/course2"
}
]
}
]
}
103 changes: 5 additions & 98 deletions src/data/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,98 +3,6 @@ export default [
id: 1,
label: "Home",
path: "/",
/* megamenu: [
{
id: 11,
title: "Group 01",
submenu: [
{
id: 111,
label: "submenu item 01",
path: "/",
status: "hot",
},
{
id: 112,
label: "submenu item 02",
path: "#",
},
{
id: 113,
label: "submenu item 03",
path: "#",
status: "hot",
},
{
id: 114,
label: "submenu item 04",
path: "#",
},
{
id: 115,
label: "submenu item 05",
path: "#",
},
{
id: 116,
label: "submenu item 06",
path: "#",
},
],
},
{
id: 12,
title: "Group 02",
submenu: [
{
id: 121,
label: "submenu item 07",
path: "/",
status: "coming soon",
},
{
id: 122,
label: "submenu item 08",
path: "/",
status: "coming soon",
},
{
id: 123,
label: "submenu item 09",
path: "/",
status: "coming soon",
},
{
id: 124,
label: "submenu item 10",
path: "/",
status: "coming soon",
},
{
id: 125,
label: "submenu item 11",
path: "/",
status: "coming soon",
},
{
id: 126,
label: "submenu item 12",
path: "/",
status: "coming soon",
},
],
},
{
id: 13,
title: "Banner",
banner: {
path: "/",
image: {
src: "/images/menu/mega-menu.jpg",
},
},
},
], */
},
{
id: 2,
Expand Down Expand Up @@ -133,12 +41,6 @@ export default [
label: "Apply to be a Student",
path: "/apply",
},
/* {
id: 26,
label: "Join our community",
path: "/join-our-community",
},
*/
],
},
{
Expand Down Expand Up @@ -166,4 +68,9 @@ export default [
label: "Donate",
path: "/donate",
},
{
id: 9,
label: "Media",
path: "/media",
},
];
31 changes: 31 additions & 0 deletions src/pages/media.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import { Container, Row, Col } from 'react-bootstrap';
import MediaGrid from '../components/media-grid';

const MediaPage = () => {
return (
<Container>
<Row>
<Col>
<h1>Media</h1>
</Col>
</Row>
<Row>
<Col>
<MediaGrid section="What we have built" />
</Col>
<Col>
<MediaGrid section="Publications" />
</Col>
<Col>
<MediaGrid section="Podcasts" />
</Col>
<Col>
<MediaGrid section="Courses" />
</Col>
</Row>
</Container>
);
};

export default MediaPage;

0 comments on commit b61031f

Please sign in to comment.