Progress on #18
This commit is contained in:
parent
a9130c1af8
commit
6a2dc0d4d8
7 changed files with 167 additions and 109 deletions
components/styles
|
@ -1,8 +1,7 @@
|
|||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import styled, { DefaultTheme } from 'styled-components';
|
||||
import { CustomLink } from '../../interfaces/LinkTypes';
|
||||
import { Service } from '../../interfaces/Services';
|
||||
import styled, { css, DefaultTheme } from 'styled-components';
|
||||
import { Service, Game } from '../../interfaces/CardTypes';
|
||||
|
||||
// needed for Online Status checks
|
||||
// TODO: migrate to shared Status type for Games and Services
|
||||
|
@ -16,7 +15,7 @@ export const PageTitle = styled.h1`
|
|||
line-height: 1.15;
|
||||
font-size: 4rem;
|
||||
text-align: center;
|
||||
`
|
||||
`;
|
||||
|
||||
// replaces .description
|
||||
export const PageDescription = styled.p`
|
||||
|
@ -24,7 +23,7 @@ export const PageDescription = styled.p`
|
|||
line-height: 1.5;
|
||||
font-size: 1.5rem;
|
||||
text-align: center;
|
||||
`
|
||||
`;
|
||||
|
||||
// replaces .grid
|
||||
export const PageContentBox = styled.div`
|
||||
|
@ -33,12 +32,29 @@ export const PageContentBox = styled.div`
|
|||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
max-width: 80%;
|
||||
`
|
||||
`;
|
||||
|
||||
const CardStyle = css`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
width: 332px;
|
||||
height: 240px;
|
||||
`;
|
||||
|
||||
const CardLink = styled(Link)`
|
||||
${CardStyle}
|
||||
`;
|
||||
|
||||
const CardStyleWrap = styled.div`
|
||||
${CardStyle}
|
||||
`;
|
||||
|
||||
// replaces .card & .contentcard
|
||||
export const PageCard = styled.div`
|
||||
margin: 1rem;
|
||||
padding: 1rem;
|
||||
padding: 1.5rem 0.7rem 1.5rem 0.7rem;
|
||||
text-align: center;
|
||||
color: ${({ theme }) => theme.colors.primary};
|
||||
text-decoration: none;
|
||||
|
@ -46,7 +62,11 @@ export const PageCard = styled.div`
|
|||
border-radius: 10px;
|
||||
border-color: ${({ theme }) => theme.colors.primary};
|
||||
transition: color 0.15s ease, border-color 0.15s ease;
|
||||
max-width: 300px;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
h2 {
|
||||
margin: 0 0 1rem 0;
|
||||
|
@ -55,15 +75,20 @@ export const PageCard = styled.div`
|
|||
|
||||
p {
|
||||
margin: 0;
|
||||
font-size: 1.2rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
&:focus,:active,:hover {
|
||||
${CardStyleWrap}:focus,${CardStyleWrap}:active,${CardStyleWrap}:hover & {
|
||||
color: ${({ theme }) => theme.colors.secondary};
|
||||
border-color: ${({ theme }) => theme.colors.secondary};
|
||||
}
|
||||
`
|
||||
|
||||
${CardLink}:focus,${CardLink}:active,${CardLink}:hover & {
|
||||
color: ${({ theme }) => theme.colors.secondary};
|
||||
border-color: ${({ theme }) => theme.colors.secondary};
|
||||
}
|
||||
`;
|
||||
|
||||
// replaces the three status classes
|
||||
const OnlineStatus = styled.p<OnlinePropType>`
|
||||
|
@ -84,12 +109,31 @@ const OnlineStatus = styled.p<OnlinePropType>`
|
|||
}
|
||||
return ret;
|
||||
}};
|
||||
`
|
||||
padding: 0.2rem;
|
||||
background-color: ${({ theme }) => theme.colors.background};
|
||||
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;
|
||||
|
||||
${CardStyleWrap}:focus,${CardStyleWrap}:active,${CardStyleWrap}:hover & {
|
||||
border-color: ${({ theme }) => theme.colors.secondary};
|
||||
}
|
||||
|
||||
${CardLink}:focus,${CardLink}:active,${CardLink}:hover & {
|
||||
border-color: ${({ theme }) => theme.colors.secondary};
|
||||
}
|
||||
`;
|
||||
|
||||
// replaces .cardwarn
|
||||
const CardContentWarning = styled.p`
|
||||
color: ${({ theme }) => theme.colors.secondary};
|
||||
`
|
||||
|
||||
`;
|
||||
|
||||
// replaces .contentIcon
|
||||
const CardContentTitleIcon = styled.div`
|
||||
|
@ -98,7 +142,7 @@ const CardContentTitleIcon = styled.div`
|
|||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
height: 1.5rem;
|
||||
`
|
||||
`;
|
||||
|
||||
// replaces .contentTitle
|
||||
const CardContentTitleWrap = styled.div`
|
||||
|
@ -112,9 +156,9 @@ const CardContentTitleWrap = styled.div`
|
|||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
`
|
||||
`;
|
||||
|
||||
const CardContentTitle = ({ content }: { content: Service | CustomLink }) => {
|
||||
const CardContentTitle = ({ content }: { content: Service | Game }) => {
|
||||
return (
|
||||
<CardContentTitleWrap>
|
||||
{
|
||||
|
@ -130,25 +174,67 @@ const CardContentTitle = ({ content }: { content: Service | CustomLink }) => {
|
|||
}
|
||||
|
||||
// Card Content Component for Games Page
|
||||
export const CardContentGame = ({ content }: { content: CustomLink }) => {
|
||||
return (
|
||||
<>
|
||||
<CardContentTitle content={content} />
|
||||
<p>{content.desc}</p>
|
||||
<p>{content.ip}</p>
|
||||
<OnlineStatus status={content.status}>{content.status}</OnlineStatus>
|
||||
</>
|
||||
)
|
||||
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;
|
||||
}
|
||||
|
||||
// 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>
|
||||
</>
|
||||
)
|
||||
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;
|
||||
}
|
|
@ -31,12 +31,11 @@ export const Footer = styled.footer`
|
|||
border-top: 1px solid ${({ theme }) => theme.colors.primary };
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
`
|
||||
|
||||
// TODO
|
||||
/* .footer a {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
} */
|
||||
a {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue