Skip to content

Commit

Permalink
Merge pull request #105 from ruby10127130/feat/Component/TermsMenu
Browse files Browse the repository at this point in the history
Feat/component/terms menu
  • Loading branch information
JohnsonMao authored Oct 18, 2024
2 parents 8871f37 + 5ee4991 commit 59fb7c3
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 3 deletions.
2 changes: 2 additions & 0 deletions components/Terms/Ipr.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import { TermsWrapper, PaperWrapper } from './Terms.styled';
import TermsMenu from './TermsMenu';

const Terms = () => {
return (
<TermsWrapper>
<TermsMenu />
<PaperWrapper>
<h2>島島阿學資源共享自主學習網站智慧財產權</h2>
<p>
Expand Down
4 changes: 2 additions & 2 deletions components/Terms/Privacypolicy.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import styled from '@emotion/styled';
import { Paper } from '@mui/material';
import { TermsWrapper, PaperWrapper } from './Terms.styled';
import TermsMenu from './TermsMenu';

const Terms = () => {
return (
<TermsWrapper>
<TermsMenu />
<PaperWrapper>
<h2>島島阿學資源共享自主學習網站隱私權政策</h2>
<p>
Expand Down
2 changes: 2 additions & 0 deletions components/Terms/Service.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import { TermsWrapper, PaperWrapper } from './Terms.styled';
import TermsMenu from './TermsMenu';

const Terms = () => {
return (
<TermsWrapper>
<TermsMenu />
<PaperWrapper>
<h2>島島阿學資源共享自主學習網站使用者條款</h2>
<p>
Expand Down
6 changes: 5 additions & 1 deletion components/Terms/Terms.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { Paper } from '@mui/material';
export const TermsWrapper = styled.section`
padding-top: 40px;
padding-bottom: 40px;
position: relative;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: center;
`;

export const PaperWrapper = styled(Paper)`
width: min(90%, 800px);
margin: 0 auto;
padding: 40px 20px;
@media (max-width: 767px) {
Expand Down
107 changes: 107 additions & 0 deletions components/Terms/TermsMenu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React from 'react';
import styled from '@emotion/styled';
import Link from 'next/link';
import { useRouter } from 'next/router';

const TermsMenuWrapper = styled.nav`
position: sticky;
top: 138px;
left: 0;
padding: 40px 0;
margin-right: 1em;
background-color: #fff;
width: 200px;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
@media (max-width: 1040px) {
display: none;
}
h2 {
margin-bottom: 1em;
padding: 0 1em;
font-weight: 500;
font-size: 18px;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
}
li {
margin-bottom: 10px;
}
a {
color: #16b9b3;
padding: 0 1em;
@media (hover: hover) {
&:hover {
text-decoration: underline;
text-underline-offset: 0.2em;
}
}
}
.current {
position: relative;
&:before {
content: '';
position: absolute;
left: 0em;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 0;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
border-left: 0.5em solid #16b9b3;
border-right: 0.5em solid transparent;
}
}
`;

const TermsMenu = () => {
const router = useRouter();
const currentPath = router.pathname;

return (
<TermsMenuWrapper>
<h2>網站規約</h2>
<ul>
<li>
<Link
href="/terms/privacypolicy"
className={currentPath === '/terms/privacypolicy' ? 'current' : ''}
>
隱私權政策
</Link>
</li>
<li>
<Link
href="/terms/ipr"
className={currentPath === '/terms/ipr' ? 'current' : ''}
>
智慧財產權
</Link>
</li>
<li>
<Link
href="/terms/service"
className={currentPath === '/terms/service' ? 'current' : ''}
>
使用者條款
</Link>
</li>
</ul>
</TermsMenuWrapper>
);
};

export default TermsMenu;

0 comments on commit 59fb7c3

Please sign in to comment.