2022-12-15 23:11:30 +00:00
|
|
|
import Link from 'next/link';
|
|
|
|
import Image from 'next/image';
|
|
|
|
import styled, { DefaultTheme } from 'styled-components';
|
2022-12-15 22:20:26 +00:00
|
|
|
import { CustomLink } from '../../interfaces/LinkTypes';
|
2022-12-15 23:11:30 +00:00
|
|
|
import { Service } from '../../interfaces/Services';
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
// needed for Online Status checks
|
|
|
|
// TODO: migrate to shared Status type for Games and Services
|
|
|
|
interface OnlinePropType {
|
|
|
|
status: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// replaces .title
|
|
|
|
export const PageTitle = styled.h1`
|
|
|
|
margin: 0;
|
|
|
|
line-height: 1.15;
|
|
|
|
font-size: 4rem;
|
|
|
|
text-align: center;
|
|
|
|
`
|
|
|
|
|
|
|
|
// replaces .description
|
|
|
|
export const PageDescription = styled.p`
|
|
|
|
margin: 4rem 0;
|
|
|
|
line-height: 1.5;
|
|
|
|
font-size: 1.5rem;
|
|
|
|
text-align: center;
|
|
|
|
`
|
|
|
|
|
|
|
|
// replaces .grid
|
|
|
|
export const PageContentBox = styled.div`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
max-width: 80%;
|
|
|
|
`
|
|
|
|
|
|
|
|
// replaces .card & .contentcard
|
|
|
|
export const PageCard = styled.div`
|
|
|
|
margin: 1rem;
|
|
|
|
padding: 1rem;
|
|
|
|
text-align: center;
|
|
|
|
color: ${({ theme }) => theme.colors.primary};
|
|
|
|
text-decoration: none;
|
|
|
|
border: 1px solid;
|
|
|
|
border-radius: 10px;
|
|
|
|
border-color: ${({ theme }) => theme.colors.primary};
|
|
|
|
transition: color 0.15s ease, border-color 0.15s ease;
|
|
|
|
max-width: 300px;
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
margin: 0 0 1rem 0;
|
|
|
|
font-size: 1.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin: 0;
|
2022-12-15 23:11:30 +00:00
|
|
|
font-size: 1.2rem;
|
2022-12-15 22:20:26 +00:00
|
|
|
line-height: 1.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus,:active,:hover {
|
|
|
|
color: ${({ theme }) => theme.colors.secondary};
|
|
|
|
border-color: ${({ theme }) => theme.colors.secondary};
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2022-12-15 23:11:30 +00:00
|
|
|
// replaces the three status classes
|
2022-12-15 22:20:26 +00:00
|
|
|
const OnlineStatus = styled.p<OnlinePropType>`
|
|
|
|
color: ${props => {
|
|
|
|
let ret;
|
|
|
|
switch (props.status) {
|
|
|
|
case "Online":
|
|
|
|
ret = ({ theme }: { theme: DefaultTheme }) => theme.colors.online;
|
|
|
|
break;
|
|
|
|
case "Loading":
|
|
|
|
ret = ({ theme }: { theme: DefaultTheme }) => theme.colors.loading;
|
|
|
|
break;
|
|
|
|
case "Offline":
|
|
|
|
ret = ({ theme }: { theme: DefaultTheme }) => theme.colors.offline;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = ({ theme }: { theme: DefaultTheme }) => theme.colors.offline;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}};
|
|
|
|
`
|
|
|
|
|
2022-12-15 23:11:30 +00:00
|
|
|
// replaces .cardwarn
|
|
|
|
const CardContentWarning = styled.p`
|
|
|
|
color: ${({ theme }) => theme.colors.secondary};
|
|
|
|
`
|
|
|
|
|
|
|
|
// replaces .contentIcon
|
|
|
|
const CardContentTitleIcon = styled.div`
|
|
|
|
object-fit: "contain";
|
|
|
|
margin-right: 0.4rem;
|
|
|
|
position: relative;
|
|
|
|
aspect-ratio: 1;
|
|
|
|
height: 1.5rem;
|
|
|
|
`
|
|
|
|
|
|
|
|
// replaces .contentTitle
|
|
|
|
const CardContentTitleWrap = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
margin: 0;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const CardContentTitle = ({ content }: { content: Service | CustomLink }) => {
|
|
|
|
return (
|
|
|
|
<CardContentTitleWrap>
|
|
|
|
{
|
|
|
|
content.icon ? (
|
|
|
|
<CardContentTitleIcon>
|
|
|
|
<Image alt="icon" src={content.icon} fill></Image>
|
|
|
|
</CardContentTitleIcon>
|
|
|
|
) : (<></>)
|
|
|
|
}
|
|
|
|
<h2>{content.name}</h2>
|
|
|
|
</CardContentTitleWrap>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-12-15 22:20:26 +00:00
|
|
|
// Card Content Component for Games Page
|
2022-12-15 23:11:30 +00:00
|
|
|
export const CardContentGame = ({ content }: { content: CustomLink }) => {
|
2022-12-15 22:20:26 +00:00
|
|
|
return (
|
|
|
|
<>
|
2022-12-15 23:11:30 +00:00
|
|
|
<CardContentTitle content={content} />
|
2022-12-15 22:20:26 +00:00
|
|
|
<p>{content.desc}</p>
|
|
|
|
<p>{content.ip}</p>
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-12-15 23:11:30 +00:00
|
|
|
// Card Content Component for Services Page
|
|
|
|
export const CardContentService = ({ content }: { content: Service }) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<CardContentTitle content={content} />
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
<p>{content.desc}</p>
|
|
|
|
<CardContentWarning>{content.warn}</CardContentWarning>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|