Skip to content

Commit

Permalink
Update v1.2.0 (#8)
Browse files Browse the repository at this point in the history
Features

- Increase CSS class rename from 6 to 8 letters
- Add games section
- Add APICount component
- Add game methods to service
- Add game explorer and details pages
- Add width to icon and Align to center on InfoBox component
- Add Description component
- Add SubTitle component
- Add Section components and Validation before showing links
- Add SimpleIcon component
- Add flexibility to Alert component
- Add (fixed) height to PaginationItem

Changes

- Update dependencies
- Update VerticalCard style
- Replace import type from Card components
- Replace import type from Link components
- Replace import type from Title components
- Replace h1 tag with Title Component
- Rename SimpleTitle to Title

Fixes

- Application crashing when handling null reference

*Bump version to 1.2.0*
*Upgrade to yarn 4.X*
  • Loading branch information
LucJosin authored Nov 10, 2023
1 parent 540d642 commit ec455d1
Show file tree
Hide file tree
Showing 71 changed files with 3,903 additions and 2,463 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# dependencies
/node_modules
/.pnp
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This tutorial gives a brief introduction to how to run this react (nextjs) proje
│ │ ├── Loading
│ │ └── Title
│ │ ├── EffectTitle
│ │ └── SimpleTitle
│ │ └── Title
│ ├── data
│ │ ├── Reference
│ │ └── Row
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const hashOnlyIdent = (context, _, exportName) =>
),
'md4',
'base64',
6
8
)
.replace(/[^a-zA-Z0-9-_]/g, '_')
.replace(/^(-?\d|--)/, '_$1');
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "hawbrary",
"packageManager": "yarn@4.0.1",
"version": "1.1.0",
"private": true,
"scripts": {
Expand All @@ -9,24 +10,24 @@
"lint": "next lint"
},
"dependencies": {
"@hawapi/js-sdk": "^1.1.0",
"@hawapi/js-sdk": "^1.2.0",
"next": "13.4.19",
"react": "18.2.0",
"react-dom": "18.2.0",
"swr": "^2.2.2"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "2.2.2"
},
"devDependencies": {
"@iconify-icon/react": "^1.0.8",
"@types/node": "20.5.7",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "8.48.0",
"@types/node": "^20.9.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.53.0",
"eslint-config-next": "13.4.19",
"eslint-config-prettier": "^9.0.0",
"loader-utils": "^3.2.1",
"prettier": "^3.0.3",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
22 changes: 22 additions & 0 deletions src/components/core/Alert/Alert.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
padding: 1rem 0;
background-color: rgba(var(--background-rgb), 0.3);
backdrop-filter: blur(2px);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}

.message {
display: flex;
align-items: center;
justify-content: center;
gap: 0.2rem;
font-size: 0.9rem;
text-align: center;
}

.close {
Expand All @@ -22,3 +28,19 @@
display: flex;
align-items: center;
}

@media (max-width: 780px) {
.message {
width: 80%;
flex-direction: column;
}

.close {
height: initial;
width: 100%;
top: initial;
right: 0;
position: relative;
justify-content: center;
}
}
4 changes: 2 additions & 2 deletions src/components/core/Alert/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Icon } from '@iconify-icon/react/dist/iconify.js';
import { useEffect, useState, type ReactNode } from 'react';
import SimpleIcon from '../SimpleIcon';
import styles from './Alert.module.css';

interface Props {
Expand All @@ -25,7 +25,7 @@ export default function Alert({ id, children }: Props) {
<div className={styles.banner}>
<span className={styles.message}>{children}</span>
<span className={styles.close} onClick={dismissAlert}>
<Icon icon="mdi:close" width="18" />
<SimpleIcon icon="mdi:close" size="18" />
</span>
</div>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/core/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Image from 'next/image';
import { Description } from '../Description';
import Title from '../Title/Title';
import styles from './Banner.module.css';

interface Props {
Expand All @@ -11,8 +13,8 @@ export default function Banner({ title, description, thumbnail }: Props) {
return (
<div className={styles.banner}>
<div className={styles.container}>
<h1>{title}</h1>
<p>{description}</p>
<Title value={title} />
<Description value={description} textAlign="center" />
</div>
<Image
src={thumbnail}
Expand Down
5 changes: 3 additions & 2 deletions src/components/core/Card/HorizontalCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getDetailsUrl } from '@/lib/url';
import Image from 'next/image';
import Link from 'next/link';
import { Description } from '../../Description';
import styles from './HorizontalCard.module.css';

interface Props {
Expand All @@ -11,7 +12,7 @@ interface Props {
thumbnail: string;
}

export default function HorizontalCard({
export function HorizontalCard({
uuid,
target,
title,
Expand All @@ -23,7 +24,7 @@ export default function HorizontalCard({
<div className={styles.card}>
<div className={styles.info}>
<h2>{title}</h2>
<p>{description}</p>
<Description value={description} />
</div>
<Image
src={thumbnail}
Expand Down
5 changes: 3 additions & 2 deletions src/components/core/Card/PersonCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getDetailsUrl } from '@/lib/url';
import Image from 'next/image';
import Link from 'next/link';
import SubTitle from '../../Title/SubTitle';
import styles from './PersonCard.module.css';

interface Props {
Expand All @@ -11,7 +12,7 @@ interface Props {
thumbnail: string;
}

export default function PersonCard({
export function PersonCard({
uuid,
target,
name,
Expand All @@ -29,7 +30,7 @@ export default function PersonCard({
className={styles.image}
/>
<div className={styles.container}>
<h1 className={styles.name}>{name}</h1>
<SubTitle value={name} />
{description.map((item, key) => {
return (
<span key={key} className={styles.description}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/core/Card/SimpleCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getDetailsUrl } from '@/lib/url';
import Image from 'next/image';
import Link from 'next/link';
import SubTitle from '../../Title/SubTitle';
import styles from './SimpleCard.module.css';

interface Props {
Expand All @@ -11,7 +12,7 @@ interface Props {
thumbnail: string;
}

export default function SimpleCard({
export function SimpleCard({
uuid,
target,
title,
Expand All @@ -29,7 +30,7 @@ export default function SimpleCard({
className={styles.image}
/>
<div className={styles.container}>
<h1 className={styles.title}>{title}</h1>
<SubTitle value={title} />
<p className={styles.description}>{description}</p>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/components/core/Card/VerticalCard/VerticalCard.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.card {
width: 100%;
height: 32rem;
width: 100%;
max-width: 24rem;
border: 1px solid #dd0400;
border-radius: 20px;
position: relative;
Expand All @@ -14,7 +15,6 @@
}

.more {
height: 13rem;
width: 100%;
display: flex;
gap: 2rem;
Expand All @@ -40,6 +40,10 @@

.description {
font-size: 0.9em;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}

.routers {
Expand Down
2 changes: 1 addition & 1 deletion src/components/core/Card/VerticalCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
children?: ReactNode;
}

export default function VerticalCard(props: Props) {
export function VerticalCard(props: Props) {
return (
<div className={styles.card}>
<Image
Expand Down
15 changes: 4 additions & 11 deletions src/components/core/Card/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import HorizontalCard from './HorizontalCard';
import PersonCard from './PersonCard';
import SimpleCard from './SimpleCard';
import VerticalCard from './VerticalCard';

export const Card = {
Simple: SimpleCard,
Horizontal: HorizontalCard,
Vertical: VerticalCard,
Person: PersonCard,
};
export * from './HorizontalCard';
export * from './PersonCard';
export * from './SimpleCard';
export * from './VerticalCard';
5 changes: 5 additions & 0 deletions src/components/core/Description/Description.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.description {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
22 changes: 22 additions & 0 deletions src/components/core/Description/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Property } from 'csstype';
import styles from './Description.module.css';

interface Props {
value?: string;
children?: string;
textAlign?: Property.TextAlign;
fontSize?: string;
}

export function Description({
value,
children,
textAlign = 'initial',
fontSize = '1em',
}: Props) {
return (
<p className={styles.description} style={{ textAlign, fontSize }}>
{value ?? children}
</p>
);
}
4 changes: 2 additions & 2 deletions src/components/core/Link/SecondaryLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Icon } from '@iconify-icon/react/dist/iconify.js';
import Link from 'next/link';
import SimpleIcon from '../../SimpleIcon';
import styles from './SecondaryLink.module.css';

interface Props {
Expand All @@ -13,7 +13,7 @@ export function SecondaryLink({ href, name, isLocal = false }: Props) {
<Link href={href} target={isLocal ? undefined : '_blank'}>
<div className={styles.button}>
{name}
{!isLocal && <Icon icon="mdi:open-in-new" width="16" />}
{!isLocal && <SimpleIcon icon="mdi:open-in-new" />}
</div>
</Link>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/core/Link/SimpleLink/SimpleLink.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
color: red;
border-bottom: 1px solid transparent;
transition: all 0.2s;
display: flex;
}

.link:hover {
Expand Down
10 changes: 7 additions & 3 deletions src/components/core/Link/SimpleLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Icon } from '@iconify-icon/react/dist/iconify.js';
import Link from 'next/link';
import SimpleIcon from '../../SimpleIcon';
import styles from './SimpleLink.module.css';

interface Props {
href: string;
name: string;
isLocal?: boolean;
showIcon?: boolean;
iconSize?: string;
}

export default function SimpleLink({
export function SimpleLink({
href,
name,
isLocal = false,
showIcon = true,
iconSize = '15',
}: Props) {
return (
<Link
Expand All @@ -22,7 +24,9 @@ export default function SimpleLink({
target={isLocal ? undefined : '_blank'}
>
{name}
{!isLocal && showIcon && <Icon icon="mdi:open-in-new" width="15" />}
{!isLocal && showIcon && (
<SimpleIcon icon="mdi:open-in-new" size={iconSize} />
)}
</Link>
);
}
12 changes: 3 additions & 9 deletions src/components/core/Link/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { PrimaryLink } from './PrimaryLink';
import { SecondaryLink } from './SecondaryLink';
import SimpleLink from './SimpleLink';

export const Link = {
Primary: PrimaryLink,
Secondary: SecondaryLink,
Simple: SimpleLink,
};
export * from './PrimaryLink';
export * from './SecondaryLink';
export * from './SimpleLink';
Empty file.
Loading

0 comments on commit ec455d1

Please sign in to comment.