-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from kachun333/dev
Release as v3.0.2
- Loading branch information
Showing
19 changed files
with
214 additions
and
167 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"short_name": "醇忆 Grad Mag", | ||
"short_name": "醇憶 Grad Mag", | ||
"name": "KMPk 16/17 Grad Mag", | ||
"icons": [ | ||
{ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import CloudResponsiveImg from "components/common/CloudResponsiveImg"; | ||
import React from "react"; | ||
|
||
interface BannerImageProps { | ||
fileName: string; | ||
className?: string; | ||
imgProps?: React.DetailedHTMLProps< | ||
React.ImgHTMLAttributes<HTMLImageElement>, | ||
HTMLImageElement | ||
>; | ||
} | ||
|
||
const BannerImage: React.FC<BannerImageProps> = ({ | ||
fileName, | ||
className, | ||
imgProps, | ||
}) => { | ||
return ( | ||
<CloudResponsiveImg | ||
folderPath="webp/banners" | ||
fileName={fileName} | ||
className={className} | ||
imgProps={imgProps} | ||
/> | ||
); | ||
}; | ||
|
||
export default BannerImage; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
|
||
interface CloudResponsiveImgProps { | ||
folderPath: string; | ||
fileName: string; | ||
className?: string; | ||
imgProps?: React.DetailedHTMLProps< | ||
React.ImgHTMLAttributes<HTMLImageElement>, | ||
HTMLImageElement | ||
>; | ||
} | ||
|
||
const STORAGE_HOST = "https://storage.googleapis.com/ourpromise.appspot.com"; | ||
|
||
const CloudResponsiveImg: React.FC<CloudResponsiveImgProps> = ({ | ||
folderPath, | ||
fileName, | ||
className, | ||
imgProps, | ||
}) => { | ||
const uriEncodedFileName = encodeURI(fileName); | ||
const path = `${STORAGE_HOST}/${folderPath}`; | ||
return ( | ||
<img | ||
className={className} | ||
src={`${path}/300x200/${uriEncodedFileName}.webp`} | ||
srcSet={` | ||
${path}/300x200/${uriEncodedFileName}.webp 300w, | ||
${path}/600x400/${uriEncodedFileName}.webp 600w, | ||
${path}/900x600/${uriEncodedFileName}.webp 900w, | ||
${path}/1200x800/${uriEncodedFileName}.webp 1200w, | ||
${path}/2400x1600/${uriEncodedFileName}.webp 2400w | ||
`} | ||
alt={fileName} | ||
{...imgProps} | ||
/> | ||
); | ||
}; | ||
|
||
export default CloudResponsiveImg; |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const FEAT_CARDS = [ | ||
{ | ||
title: "Graduates", | ||
link: "/graduates", | ||
imgFileName: "graduates", | ||
}, | ||
{ | ||
title: "KMPk TV", | ||
link: "/videos", | ||
imgFileName: "videos", | ||
}, | ||
]; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { styled } from "@mui/material/styles"; | ||
import BannerImage from "components/common/BannerImage"; | ||
|
||
export const StyledCardImage = styled(BannerImage)({ | ||
width: "100%", | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Card, CardActionArea, Grid, Typography } from "@mui/material"; | ||
import * as SS from "components/styled"; | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
import { FEAT_CARDS } from "./index.constants"; | ||
import * as S from "./index.styled"; | ||
|
||
const FeaturedContent = () => { | ||
return ( | ||
<Grid container spacing={4}> | ||
{FEAT_CARDS.map((card) => ( | ||
<Grid item key={card.title} xs={12} sm={6}> | ||
<Card> | ||
<CardActionArea> | ||
<Link to={card.link}> | ||
<S.StyledCardImage | ||
fileName={card.imgFileName} | ||
imgProps={{ | ||
sizes: | ||
"(min-width: 1536px) 768px, (min-width: 1200px) 600px, (min-width: 900px) 450px, (min-width: 600px) 300px, 100vw", | ||
}} | ||
/> | ||
</Link> | ||
</CardActionArea> | ||
<SS.StyledCardContent> | ||
<Typography variant="h6" gutterBottom> | ||
{card.title} | ||
</Typography> | ||
</SS.StyledCardContent> | ||
</Card> | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default FeaturedContent; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { styled } from "@mui/material/styles"; | ||
import BannerImage from "components/common/BannerImage"; | ||
|
||
export const HeroContainer = styled("div")(({ theme }) => ({ | ||
[theme.breakpoints.up("md")]: { | ||
display: "flex", | ||
alignItems: "center", | ||
height: "calc(100vh - 64px)", | ||
overflow: "hidden", | ||
width: "100%", | ||
}, | ||
})); | ||
|
||
export const HeroImg = styled(BannerImage)({ | ||
width: "100%", | ||
}); | ||
|
||
export const AboutBox = styled("div")(({ theme }) => ({ | ||
marginTop: theme.spacing(2), | ||
marginBottom: theme.spacing(3), | ||
})); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Container from "@mui/material/Container"; | ||
import Typography from "@mui/material/Typography"; | ||
import React from "react"; | ||
import FeaturedContent from "./FeaturedContent"; | ||
import * as S from "./index.styled"; | ||
|
||
function Home() { | ||
return ( | ||
<> | ||
<S.HeroContainer> | ||
<S.HeroImg | ||
fileName="home" | ||
imgProps={{ | ||
alt: "A group photo of KMPk 16/17 students", | ||
}} | ||
/> | ||
</S.HeroContainer> | ||
<Container> | ||
<S.AboutBox> | ||
<Typography variant="h3" gutterBottom> | ||
About | ||
</Typography> | ||
<Typography variant="body1" gutterBottom> | ||
This web app serves as a platform to unite KMPk 16/17 graduates. The | ||
admin is currently migrating the physical graduation magazine to | ||
this web app. | ||
</Typography> | ||
<Typography variant="body1" gutterBottom> | ||
Stay tuned for more interesting content and features! | ||
</Typography> | ||
</S.AboutBox> | ||
<FeaturedContent /> | ||
</Container> | ||
</> | ||
); | ||
} | ||
|
||
export default Home; |
Oops, something went wrong.