Skip to content

Commit

Permalink
Merge pull request #128 from daodaoedu/v2
Browse files Browse the repository at this point in the history
fix: about page image style
  • Loading branch information
JohnsonMao authored Nov 15, 2024
2 parents 20c700b + 94f051f commit af98b59
Show file tree
Hide file tree
Showing 13 changed files with 596 additions and 224 deletions.
79 changes: 17 additions & 62 deletions components/About/Cooperate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,118 +22,73 @@ const Cooperate = () => {
>
合作夥伴
</Typography>
<Box
sx={{
margin: '20px',
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center',
flexWrap: 'wrap',
}}
>
<Box
sx={{
backgroundColor: 'black',
padding: '5px',
width: '210px',
borderRadius: '5px',
margin: '10px',
}}
>
<div className="flex flex-wrap items-center gap-4">
<div className="bg-black">
<a
href="https://grants.g0v.tw/power/?from=daoedu.tw"
target="_blank"
rel="noreferrer"
>
<img
src="https://grants.g0v.tw/power/images/g0v-logo.svg"
width={200}
height={32}
className="h-8 w-52"
alt="g0v零時政府"
/>
</a>
</Box>
<Box
sx={{
padding: '5px',
height: '120px',
borderRadius: '5px',
margin: '10px',
}}
>
</div>
<div>
<a
href="https://sch001.g0v.tw/?from=daoedu.tw"
target="_blank"
rel="noreferrer"
>
<img
src="https://sch001.g0v.tw/assets/img/main_new.jpg"
height={120}
className="h-32"
alt="g0v零時小學校"
/>
</a>
</Box>
<Box
sx={{
padding: '5px',
height: '130px',
borderRadius: '5px',
margin: '10px',
}}
>
</div>
<div>
<a
href="https://zashare.org/?from=daoedu.tw"
target="_blank"
rel="noreferrer"
>
<img
src="https://i.imgur.com/QpMVwqe.png"
height={120}
className="h-32"
alt="雜學校"
/>
</a>
</Box>
<Box
sx={{
padding: '5px',
height: '130px',
borderRadius: '5px',
margin: '10px',
}}
>
</div>
<div>
<a
href="https://www.parenting.com.tw/?from=daoedu.tw"
target="_blank"
rel="noreferrer"
>
<img
src="https://www.parenting.com.tw/files/images/fb_share.png"
height={120}
className="h-32"
alt="親子天下"
/>
</a>
</Box>
<Box
sx={{
padding: '5px',
height: '130px',
borderRadius: '5px',
margin: '10px',
}}
>
</div>
<div>
<a
href="https://codingbar.ai/?from=daoedu.tw"
target="_blank"
rel="noreferrer"
>
<img
src="https://i.imgur.com/n6GG0vF.png"
height={120}
className="h-32"
alt="Coding bar"
/>
</a>
</Box>
</Box>
</div>
</div>
</SectionWrapper>
);
};
Expand Down
18 changes: 9 additions & 9 deletions components/About/TechStack/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ const Thanks = () => {
}}
>
<LineWrapper variant="p">
<p float="left" margin="10px">
<p className="flex flex-wrap gap-2">
<img
src="https://media.giphy.com/media/I2Gobnade5rqM/giphy.gif"
height="80px"
className="h-20"
/>
<img
src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png"
height="80px"
className="h-20"
/>
<img
src="https://seeklogo.com/images/N/next-js-logo-8FCFF51DD2-seeklogo.com.png"
height="100px"
className="h-20"
/>
<img src="https://mui.com/static/logo.png" height="80px" />
<img src="https://mui.com/static/logo.png" className="h-20" />
{/* <img
src="https://redux-saga.js.org/img/Redux-Saga-Logo.png"
height="100px"
/> */}
<img
src="https://raw.githubusercontent.com/emotion-js/emotion/main/emotion.png"
height="80px"
className="h-20"
/>
<img
src="https://www.cloudflare.com/resources/images/slt3lc6tev37/CHOl0sUhrumCxOXfRotGt/9bf83d4ca877bb8f0f917c8d379a84ce/cloudflare-icon-color_3x.png"
height="80px"
className="h-20"
/>
<img
src="https://repository-images.githubusercontent.com/175043545/92352780-93a7-11ea-805a-0e76ca033a94"
height="80px"
className="h-20"
/>
<img
src="https://upload.wikimedia.org/wikipedia/commons/4/45/Notion_app_logo.png"
height="80px"
className="h-20"
/>
</p>
</LineWrapper>
Expand Down
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ const withPWA = require('next-pwa')({
module.exports = withPWA({
reactStrictMode: false,
staticPageGenerationTimeout: 600,
transpilePackages: ['@mdxeditor/editor'],
images: {
domains: ['imgur.com', 'images.unsplash.com', 'lh3.googleusercontent.com'],
},
webpack: (config) => {
const experiments = { ...config.experiments, topLevelAwait: true };
return Object.assign(config, { experiments });
},
env: {
HOSTNAME: 'https://www.daoedu.tw',
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"devDependencies": {
"@emotion/babel-plugin": "^11.9.2",
"@next/eslint-plugin-next": "^13.2.1",
"@tailwindcss/typography": "^0.5.15",
"@types/chrome": "^0.0.206",
"autoprefixer": "^10.4.20",
"babel-plugin-import": "^1.13.8",
Expand Down
177 changes: 177 additions & 0 deletions shared/components/CheckLink.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
import { useState, forwardRef, useId, useImperativeHandle } from 'react';
import Link from 'next/link';
import {
Dialog,
DialogTitle,
Box,
Button,
Slide,
Typography,
useMediaQuery,
FormControlLabel,
Checkbox,
} from '@mui/material';
import { getTrustWebsitesStorage } from '@/utils/storage';

const TransitionSlide = forwardRef((props, ref) => {
return <Slide direction="up" ref={ref} {...props} />;
});

function InternalCheckLink(props, ref) {
const id = useId();
const isMobileScreen = useMediaQuery('(max-width: 560px)');
const [link, setLink] = useState(null);
const [isTrust, setIsTrust] = useState(false);
const titleId = `modal-title-${id}`;
const descriptionId = `modal-description-${id}`;

const handleClose = () => {
setLink(null);
setIsTrust(false);
};

const handleGoToWebsite = () => {
const trustWebsites = getTrustWebsitesStorage().get();
const data = Array.isArray(trustWebsites) ? trustWebsites : [];

if (isTrust && link) {
data.push(link.hostname);
}

getTrustWebsitesStorage().set(data);
handleClose();
};

useImperativeHandle(
ref,
() => ({
check: (href) => {
try {
const trustWebsites = getTrustWebsitesStorage().get();
const data = Array.isArray(trustWebsites) ? trustWebsites : [];
const newLink = new URL(href);

if (data.includes(newLink.hostname)) {
window.open(newLink.href, '_blank');
return;
}
setLink(newLink);
} catch {
window.open(href, '_blank');
}
}
}),
[]
);

return (
<Dialog
keepMounted
scroll="body"
fullScreen={isMobileScreen}
open={!!link}
onClose={handleClose}
aria-labelledby={titleId}
aria-describedby={descriptionId}
TransitionComponent={TransitionSlide}
sx={{
'.MuiPaper-root': {
marginTop: isMobileScreen ? 'calc(100vh - 430px)' : undefined,
},
}}
PaperProps={{
sx: {
p: '32px 24px',
maxWidth: '400px',
width: '100%',
borderRadius: '16px',
},
}}
>
<DialogTitle
id={titleId}
sx={{
p: 0,
mb: '8px',
color: '#536166',
fontWeight: 700,
fontSize: '22px',
textAlign: 'center',
}}
>
正在離開島島阿學
</DialogTitle>
{link && (
<>
<div id={descriptionId}>
<Typography component="p">這個連結將帶您前往以下網站</Typography>
<Typography
variant="caption"
color="grey"
sx={{ wordBreak: 'break-word' }}
>
{decodeURI(link.href)}
</Typography>
</div>
<div>
<FormControlLabel
control={<Checkbox size="small" onClick={() => setIsTrust((pre) => !pre)} />}
label={
<Typography variant="caption">{`從現在開始信任 ${link.hostname} 連結`}</Typography>
}
checked={isTrust}
/>
</div>
<Box
sx={{
mt: '16px',
display: 'flex',
flexDirection: 'row-reverse',
gap: '8px',
}}
>
<Button
LinkComponent={Link}
sx={{
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
boxShadow: '0 4px 10px #C4C2C166',
}}
size="large"
variant="contained"
fullWidth
href={link.href}
target="_blank"
rel="noopener noreferrer"
onClick={handleGoToWebsite}
>
前往網站
</Button>
<Button
sx={{
borderRadius: '20px',
bgcolor: '#ffffff',
color: '#1f4645',
boxShadow: '0 4px 10px #C4C2C166',
'&:hover': {
bgcolor: '#dddddd',
},
}}
variant="contained"
size="large"
fullWidth
onClick={handleClose}
>
返回
</Button>
</Box>
</>
)}
</Dialog>
);
}

const CheckLink = forwardRef(InternalCheckLink);

export default CheckLink;
Loading

0 comments on commit af98b59

Please sign in to comment.