diff --git a/src/components/ClientDetails.tsx b/src/components/ClientDetails.tsx index 8aec4b41..cdaffce9 100644 --- a/src/components/ClientDetails.tsx +++ b/src/components/ClientDetails.tsx @@ -1,10 +1,9 @@ import React from 'react'; +import DetailsCard from './common/DetailsCard'; import PlatformIcon from './PlatformIcon'; import { Client, ClientType, LicenseType } from '../data/clients'; -import './ClientDetails.css'; - const ClientTypeBadge = ({ clientType }: { clientType: ClientType }) => { if (clientType === ClientType.Official) { return Official; @@ -22,36 +21,29 @@ const LicenseTypeBadge = ({ licenseType }: { licenseType: LicenseType }) => { }; const ClientDetails = ({ client }: { client: Client }) => ( -
-
-
-

{client.name}

-
- - -
-
-
- {client.platforms.map((platform, index) => ( - - ))} -
-
-
{client.description}
-
- {client.secondaryLinks?.map(({ id, url, name }) => ( - - {name} - - ))} -
- {client.primaryLinks.map(({ id, url, name }) => ( - - {name} - - ))} -
-
+ + + + + } + icons={client.platforms.map((platform, index) => ( + + ))} + primaryButtons={client.primaryLinks.map(({ id, url, name }) => ( + + {name} + + ))} + secondaryButtons={client.secondaryLinks?.map(({ id, url, name }) => ( + + {name} + + ))} + /> ); export default ClientDetails; diff --git a/src/components/ClientDetails.css b/src/components/common/DetailsCard.css similarity index 50% rename from src/components/ClientDetails.css rename to src/components/common/DetailsCard.css index 5c5bf25e..c44d63b0 100644 --- a/src/components/ClientDetails.css +++ b/src/components/common/DetailsCard.css @@ -1,80 +1,80 @@ /* stylelint-disable docusaurus/copyright-header */ -.client__header { +.details-card__header { display: flex; align-items: center; } -.client__header__start { +.details-card__header__start { flex-grow: 1; display: flex; } -.client__header__start h3 { +.details-card__header__start h3 { margin-bottom: 0; } -.client__header__start__badges { +.details-card__header__start__badges { margin-left: 1rem; } -.client__footer { +.details-card__footer { display: flex; } -.client__platform-icon { +.details-card__icons > * { margin-left: 1rem; } -.client__footer .button { +.details-card__footer .button { margin-left: 1rem; } -.client__footer .button:first-of-type { +.details-card__footer .button:first-of-type { margin-left: 0; } @media (max-width: 420px) { - .client__header { + .details-card__header { flex-direction: column; text-align: center; } - .client__platform-icon { + .details-card__icons > * { margin-top: 0.5rem; } - .client__platform-icon:first-of-type { + .details-card__icons > *:first-of-type { margin-left: 0; } - .card__body { + .details-card .card__body { padding-top: 0; } } @media (max-width: 560px) { - .client__header__start { + .details-card__header__start { flex-direction: column; } - .client__header__start__badges { + .details-card__header__start__badges { margin-top: 0.5rem; } - .client__header__start__badges:first-of-type { + .details-card__header__start__badges:first-of-type { margin-left: 0; } - .client__footer { + .details-card__footer { flex-direction: column; } - .client__footer .button { + .details-card__footer .button { margin: 1rem 0 0; } - .client__footer .button:first-of-type { + .details-card__footer .button:first-of-type { margin-top: 0; } } diff --git a/src/components/common/DetailsCard.tsx b/src/components/common/DetailsCard.tsx new file mode 100644 index 00000000..c6effdc2 --- /dev/null +++ b/src/components/common/DetailsCard.tsx @@ -0,0 +1,39 @@ +import React, { FunctionComponent, ReactNode } from 'react'; + +import './DetailsCard.css'; + +type DetailsCardProps = { + title: string; + description: string; + badges?: ReactNode; + icons?: ReactNode; + primaryButtons?: Array; + secondaryButtons?: Array; +}; + +const DetailsCard: FunctionComponent = ({ + title, + description, + badges = [], + icons = [], + primaryButtons = [], + secondaryButtons = [] +}) => ( +
+
+
+

{title}

+
{badges}
+
+
{icons}
+
+
{description}
+
+ {secondaryButtons} +
+ {primaryButtons} +
+
+); + +export default DetailsCard;