2022-12-15 23:11:30 +00:00
|
|
|
import Link from 'next/link';
|
|
|
|
import Image from 'next/image';
|
2022-12-17 00:20:58 +00:00
|
|
|
import styled, { css, DefaultTheme } from 'styled-components';
|
|
|
|
import { Service, Game } from '../../interfaces/CardTypes';
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
// needed for Online Status checks
|
|
|
|
interface OnlinePropType {
|
|
|
|
status: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// replaces .title
|
|
|
|
export const PageTitle = styled.h1`
|
|
|
|
margin: 0;
|
2022-12-18 03:57:22 +00:00
|
|
|
padding: 0.25rem 1rem;
|
2022-12-15 22:20:26 +00:00
|
|
|
line-height: 1.15;
|
|
|
|
font-size: 4rem;
|
|
|
|
text-align: center;
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.colors.background ? theme.colors.background : ""};
|
|
|
|
border-radius: 15px;
|
2022-12-17 00:20:58 +00:00
|
|
|
`;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
// replaces .description
|
|
|
|
export const PageDescription = styled.p`
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.colors.background ? theme.colors.background : ""};
|
|
|
|
padding: 0.25rem 0.5rem;
|
2022-12-19 20:03:08 +00:00
|
|
|
margin: 4rem 2rem;
|
2022-12-15 22:20:26 +00:00
|
|
|
line-height: 1.5;
|
|
|
|
font-size: 1.5rem;
|
|
|
|
text-align: center;
|
2022-12-18 03:57:22 +00:00
|
|
|
border-radius: 10px;
|
2022-12-17 00:20:58 +00:00
|
|
|
`;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
// replaces .grid
|
|
|
|
export const PageContentBox = styled.div`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
max-width: 80%;
|
2022-12-17 00:20:58 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
const CardStyle = css`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
position: relative;
|
|
|
|
width: 332px;
|
|
|
|
height: 240px;
|
|
|
|
`;
|
|
|
|
|
2022-12-18 04:01:10 +00:00
|
|
|
export const CardLink = styled(Link)`
|
2022-12-17 00:20:58 +00:00
|
|
|
${CardStyle}
|
|
|
|
`;
|
|
|
|
|
2022-12-18 04:01:10 +00:00
|
|
|
export const CardStyleWrap = styled.div`
|
2022-12-17 00:20:58 +00:00
|
|
|
${CardStyle}
|
|
|
|
`;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
// replaces .card & .contentcard
|
|
|
|
export const PageCard = styled.div`
|
|
|
|
margin: 1rem;
|
2022-12-18 03:57:22 +00:00
|
|
|
padding: 23px 10px;
|
2022-12-15 22:20:26 +00:00
|
|
|
text-align: center;
|
|
|
|
color: ${({ theme }) => theme.colors.primary};
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.colors.background};
|
2022-12-15 22:20:26 +00:00
|
|
|
text-decoration: none;
|
2022-12-18 03:57:22 +00:00
|
|
|
border: 2px solid;
|
2022-12-15 22:20:26 +00:00
|
|
|
border-radius: 10px;
|
|
|
|
border-color: ${({ theme }) => theme.colors.primary};
|
2022-12-18 03:57:22 +00:00
|
|
|
transition: all 0.1s linear;
|
2022-12-17 00:20:58 +00:00
|
|
|
width: 300px;
|
|
|
|
height: 200px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-between;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
|
|
|
h2 {
|
|
|
|
margin: 0 0 1rem 0;
|
|
|
|
font-size: 1.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin: 0;
|
2022-12-17 00:20:58 +00:00
|
|
|
font-size: 1rem;
|
2022-12-15 22:20:26 +00:00
|
|
|
line-height: 1.5;
|
|
|
|
}
|
|
|
|
|
2022-12-17 00:20:58 +00:00
|
|
|
${CardStyleWrap}:focus,${CardStyleWrap}:active,${CardStyleWrap}:hover & {
|
2022-12-15 22:20:26 +00:00
|
|
|
color: ${({ theme }) => theme.colors.secondary};
|
|
|
|
border-color: ${({ theme }) => theme.colors.secondary};
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.invertButtons ?
|
|
|
|
theme.colors.backgroundAlt ? theme.colors.backgroundAlt : theme.colors.background : theme.colors.background};
|
2022-12-15 22:20:26 +00:00
|
|
|
}
|
2022-12-17 00:20:58 +00:00
|
|
|
|
|
|
|
${CardLink}:focus,${CardLink}:active,${CardLink}:hover & {
|
|
|
|
color: ${({ theme }) => theme.colors.secondary};
|
|
|
|
border-color: ${({ theme }) => theme.colors.secondary};
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.invertButtons ?
|
|
|
|
theme.colors.backgroundAlt ? theme.colors.backgroundAlt : theme.colors.background : theme.colors.background};
|
2022-12-17 00:20:58 +00:00
|
|
|
}
|
|
|
|
`;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
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-17 00:20:58 +00:00
|
|
|
padding: 0.2rem;
|
|
|
|
border: 1px solid;
|
|
|
|
border-color: ${({ theme }) => theme.colors.primary};
|
|
|
|
border-radius: 5px;
|
|
|
|
width: min-content;
|
|
|
|
position: absolute;
|
|
|
|
top: 100; right: 50; bottom: 0; left: 50;
|
|
|
|
offset-position: bottom 10px;
|
|
|
|
transition: color 0.15s ease, border-color 0.15s ease;
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.colors.background};
|
|
|
|
background-image: ${({ theme }) => theme.backgroundImage ?
|
|
|
|
"linear-gradient("
|
|
|
|
+ theme.colors.background + "," + theme.colors.background +
|
|
|
|
"), url(" + theme.backgroundImage + ")" : ""};
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-attachment: fixed;
|
|
|
|
background-size: cover;
|
2022-12-17 00:20:58 +00:00
|
|
|
|
|
|
|
${CardStyleWrap}:focus,${CardStyleWrap}:active,${CardStyleWrap}:hover & {
|
|
|
|
border-color: ${({ theme }) => theme.colors.secondary};
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.invertButtons ?
|
|
|
|
theme.colors.backgroundAlt ? theme.colors.backgroundAlt : theme.colors.background : theme.colors.background};
|
2022-12-17 00:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
${CardLink}:focus,${CardLink}:active,${CardLink}:hover & {
|
|
|
|
border-color: ${({ theme }) => theme.colors.secondary};
|
2022-12-18 03:57:22 +00:00
|
|
|
background-color: ${({ theme }) => theme.invertButtons ?
|
|
|
|
theme.colors.backgroundAlt ? theme.colors.backgroundAlt : theme.colors.background : theme.colors.background};
|
2022-12-17 00:20:58 +00:00
|
|
|
}
|
|
|
|
`;
|
2022-12-15 22:20:26 +00:00
|
|
|
|
2022-12-15 23:11:30 +00:00
|
|
|
// replaces .cardwarn
|
|
|
|
const CardContentWarning = styled.p`
|
|
|
|
color: ${({ theme }) => theme.colors.secondary};
|
2022-12-17 00:20:58 +00:00
|
|
|
|
|
|
|
`;
|
2022-12-15 23:11:30 +00:00
|
|
|
|
|
|
|
// replaces .contentIcon
|
2022-12-18 03:57:22 +00:00
|
|
|
const CardContentTitleIcon = styled(Image)`
|
2022-12-15 23:11:30 +00:00
|
|
|
object-fit: "contain";
|
2022-12-18 03:57:22 +00:00
|
|
|
margin-right: 8px;
|
2022-12-15 23:11:30 +00:00
|
|
|
aspect-ratio: 1;
|
2022-12-18 03:57:22 +00:00
|
|
|
height: 28px;
|
2022-12-17 00:20:58 +00:00
|
|
|
`;
|
2022-12-15 23:11:30 +00:00
|
|
|
|
|
|
|
// replaces .contentTitle
|
|
|
|
const CardContentTitleWrap = styled.div`
|
2022-12-18 03:57:22 +00:00
|
|
|
position: relative;
|
2022-12-15 23:11:30 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
margin: 0;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
2022-12-17 00:20:58 +00:00
|
|
|
`;
|
2022-12-15 23:11:30 +00:00
|
|
|
|
2022-12-17 00:20:58 +00:00
|
|
|
const CardContentTitle = ({ content }: { content: Service | Game }) => {
|
2022-12-15 23:11:30 +00:00
|
|
|
return (
|
|
|
|
<CardContentTitleWrap>
|
|
|
|
{
|
|
|
|
content.icon ? (
|
2022-12-18 03:57:22 +00:00
|
|
|
<CardContentTitleIcon alt="icon" src={content.icon} width="28" height="28" sizes='10vw'/>
|
2022-12-15 23:11:30 +00:00
|
|
|
) : (<></>)
|
|
|
|
}
|
|
|
|
<h2>{content.name}</h2>
|
|
|
|
</CardContentTitleWrap>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-12-15 22:20:26 +00:00
|
|
|
// Card Content Component for Games Page
|
2022-12-17 00:20:58 +00:00
|
|
|
export const CardContentGame = ({ content }: { content: Game }) => {
|
|
|
|
let ret;
|
|
|
|
if (content.href) {
|
|
|
|
ret = (
|
|
|
|
<CardLink href={content.href}>
|
|
|
|
<PageCard>
|
|
|
|
<CardContentTitle content={content} />
|
|
|
|
<p>{content.desc}</p>
|
|
|
|
<p>{content.ip}</p>
|
|
|
|
</PageCard>
|
|
|
|
{content.status ?
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
: <></>
|
|
|
|
}
|
|
|
|
</CardLink>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = (
|
|
|
|
<CardStyleWrap>
|
|
|
|
<PageCard>
|
|
|
|
<CardContentTitle content={content} />
|
|
|
|
<p>{content.desc}</p>
|
|
|
|
<p>{content.ip}</p>
|
|
|
|
</PageCard>
|
|
|
|
{content.status ?
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
: <></>
|
|
|
|
}
|
|
|
|
</CardStyleWrap>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return ret;
|
2022-12-15 22:20:26 +00:00
|
|
|
}
|
|
|
|
|
2022-12-15 23:11:30 +00:00
|
|
|
// Card Content Component for Services Page
|
|
|
|
export const CardContentService = ({ content }: { content: Service }) => {
|
2022-12-17 00:20:58 +00:00
|
|
|
let ret;
|
|
|
|
if (content.href) {
|
|
|
|
ret = (
|
|
|
|
<CardLink href={content.href}>
|
|
|
|
<PageCard>
|
|
|
|
<CardContentTitle content={content} />
|
|
|
|
<p>{content.desc}</p>
|
|
|
|
<CardContentWarning>{content.warn}</CardContentWarning>
|
|
|
|
</PageCard>
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
</CardLink>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = (
|
|
|
|
<CardStyleWrap>
|
|
|
|
<PageCard>
|
|
|
|
<CardContentTitle content={content} />
|
|
|
|
<p>{content.desc}</p>
|
|
|
|
<CardContentWarning>{content.warn}</CardContentWarning>
|
|
|
|
</PageCard>
|
|
|
|
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
|
|
|
</CardStyleWrap>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return ret;
|
2022-12-15 23:11:30 +00:00
|
|
|
}
|