Updates title sizes

This commit is contained in:
Alicia Sykes 2023-06-24 16:42:43 +01:00
parent bc15c94315
commit e0ffc8e418
14 changed files with 73 additions and 19 deletions

View File

@ -17,6 +17,7 @@ const StyledHeading = styled.h1<HeadingProps>`
display: flex; display: flex;
gap: 1rem; gap: 1rem;
align-items: center; align-items: center;
font-size: ${TextSizes.medium};
img { // Some titles have an icon img { // Some titles have an icon
width: 2rem; width: 2rem;
border-radius: 4px; border-radius: 4px;
@ -27,8 +28,8 @@ const StyledHeading = styled.h1<HeadingProps>`
} }
${props => { ${props => {
switch (props.size) { switch (props.size) {
case 'xSmall': return `font-size: ${TextSizes.small};`; case 'xSmall': return `font-size: ${TextSizes.xSmall};`;
case 'small': return `font-size: ${TextSizes.medium};`; case 'small': return `font-size: ${TextSizes.small};`;
case 'medium': return `font-size: ${TextSizes.large};`; case 'medium': return `font-size: ${TextSizes.large};`;
case 'large': return `font-size: ${TextSizes.xLarge};`; case 'large': return `font-size: ${TextSizes.xLarge};`;
} }

View File

@ -1,11 +1,13 @@
import { ReactNode } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import colors from 'styles/colors'; import colors from 'styles/colors';
import Heading from 'components/Form/Heading';
export interface RowProps { export interface RowProps {
lbl: string, lbl: string,
val: string, val: string,
key?: string, key?: string,
children?: JSX.Element[], children?: ReactNode,
rowList?: RowProps[], rowList?: RowProps[],
title?: string, title?: string,
} }
@ -100,12 +102,28 @@ export const ExpandableRow = (props: RowProps) => {
); );
}; };
export const ListRow = (props: { list: string[], title: string }) => {
const { list, title } = props;
return (
<>
<Heading as="h4" size="small" align="left" color={colors.primary}>{title}</Heading>
{ list.map((entry: string, index: number) => {
return (
<Row lbl="" val="" key={`${title.toLocaleLowerCase()}-${index}`}>
<span>{ entry }</span>
</Row>
)}
)}
</>
);
}
const Row = (props: RowProps) => { const Row = (props: RowProps) => {
const { lbl, val, key, title, children } = props; const { lbl, val, key, title, children } = props;
if (children) return <StyledRow key={key}>{children}</StyledRow>; if (children) return <StyledRow key={key}>{children}</StyledRow>;
return ( return (
<StyledRow key={key}> <StyledRow key={key}>
<span className="lbl" title={title}>{lbl}</span> { lbl && <span className="lbl" title={title}>{lbl}</span> }
<span className="val" title={val} onClick={() => copyToClipboard(val)}> <span className="val" title={val} onClick={() => copyToClipboard(val)}>
{formatValue(val)} {formatValue(val)}
</span> </span>

View File

@ -37,7 +37,7 @@ const ListRow = (props: { list: Technology[], title: string }) => {
const { list, title } = props; const { list, title } = props;
return ( return (
<> <>
<Heading as="h3" size="small" align="left" color={colors.primary}>{title}</Heading> <Heading as="h3" align="left" color={colors.primary}>{title}</Heading>
{ list.map((entry: Technology, index: number) => { { list.map((entry: Technology, index: number) => {
return ( return (
<Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry.Name }</span></Row> <Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry.Name }</span></Row>
@ -52,7 +52,7 @@ const BuiltWithCard = (props: { technologies: TechnologyGroup[] }): JSX.Element
const { technologies } = props; const { technologies } = props;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Technologies</Heading> <Heading as="h3" align="left" color={colors.primary}>Technologies</Heading>
{ technologies.map((group: TechnologyGroup) => { { technologies.map((group: TechnologyGroup) => {
return ( return (
<ListRow key={group.tag} title={group.tag} list={group.technologies} /> <ListRow key={group.tag} title={group.tag} list={group.technologies} />

View File

@ -11,7 +11,7 @@ const CookiesCard = (props: { cookies: any }): JSX.Element => {
const cookies = props.cookies; const cookies = props.cookies;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Cookies</Heading> <Heading as="h3" align="left" color={colors.primary}>Cookies</Heading>
{ {
cookies.length === 0 && <p>No cookies found.</p> cookies.length === 0 && <p>No cookies found.</p>
} }

View File

@ -0,0 +1,34 @@
import styled from 'styled-components';
import colors from 'styles/colors';
import Card from 'components/Form/Card';
import Heading from 'components/Form/Heading';
import Row, { ListRow, RowProps } from 'components/Form/Row';
const Outer = styled(Card)`
.content {
max-height: 28rem;
overflow-y: auto;
}
`;
const DnsRecordsCard = (props: { dnsRecords: any }): JSX.Element => {
const dnsRecords = props.dnsRecords;
return (
<Outer>
<Heading as="h3" align="left" color={colors.primary}>DNS Records</Heading>
<div className="content">
{ dnsRecords.A && <Row lbl="A" val={dnsRecords.A.address} /> }
{ dnsRecords.AAAA?.length > 0 && <ListRow title="AAAA" list={dnsRecords.AAAA} /> }
{ dnsRecords.MX?.length > 0 && <ListRow title="MX" list={dnsRecords.MX} /> }
{ dnsRecords.CNAME?.length > 0 && <ListRow title="CNAME" list={dnsRecords.CNAME} /> }
{ dnsRecords.NS?.length > 0 && <ListRow title="NS" list={dnsRecords.NS} /> }
{ dnsRecords.PTR?.length > 0 && <ListRow title="PTR" list={dnsRecords.PTR} /> }
{ dnsRecords.SOA?.length > 0 && <ListRow title="SOA" list={dnsRecords.SOA} /> }
</div>
</Outer>
);
}
export default DnsRecordsCard;

View File

@ -13,7 +13,7 @@ const HeadersCard = (props: { headers: any }): JSX.Element => {
const headers = props.headers; const headers = props.headers;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Headers</Heading> <Heading as="h3" align="left" color={colors.primary}>Headers</Heading>
{ {
Object.keys(headers).map((header: string, index: number) => { Object.keys(headers).map((header: string, index: number) => {
return ( return (

View File

@ -6,7 +6,7 @@ import Card from 'components/Form/Card';
import Heading from 'components/Form/Heading'; import Heading from 'components/Form/Heading';
const Outer = styled(Card)` const Outer = styled(Card)`
max-height: 20rem; max-height: 28rem;
overflow: auto; overflow: auto;
`; `;
@ -22,7 +22,7 @@ const HostListSection = (props: { list: string[], title: string }) => {
const { list, title } = props; const { list, title } = props;
return ( return (
<> <>
<Heading as="h3" size="small" align="left" color={colors.primary}>{title}</Heading> <Heading as="h3" align="left" color={colors.primary}>{title}</Heading>
{ list.map((entry: string, index: number) => { { list.map((entry: string, index: number) => {
return ( return (
<Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry }</span></Row> <Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry }</span></Row>

View File

@ -95,7 +95,7 @@ const LighthouseCard = (props: { lighthouse: any }): JSX.Element => {
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Performance</Heading> <Heading as="h3" align="left" color={colors.primary}>Performance</Heading>
{ Object.keys(categories).map((title: string, index: number) => { { Object.keys(categories).map((title: string, index: number) => {
const scoreIds = categories[title].auditRefs.map((ref: { id: string }) => ref.id); const scoreIds = categories[title].auditRefs.map((ref: { id: string }) => ref.id);
const scoreList = scoreIds.map((id: string) => { const scoreList = scoreIds.map((id: string) => {

View File

@ -7,7 +7,7 @@ import Row, { RowProps } from 'components/Form/Row';
const Outer = styled(Card)` const Outer = styled(Card)`
.content { .content {
max-height: 20rem; max-height: 28rem;
overflow-y: auto; overflow-y: auto;
} }
`; `;
@ -15,7 +15,7 @@ const Outer = styled(Card)`
const RobotsTxtCard = (props: { robotTxt: RowProps[] }): JSX.Element => { const RobotsTxtCard = (props: { robotTxt: RowProps[] }): JSX.Element => {
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Crawl Rules</Heading> <Heading as="h3" align="left" color={colors.primary}>Crawl Rules</Heading>
<div className="content"> <div className="content">
{ {
props.robotTxt.length === 0 && <p>No crawl rules found.</p> props.robotTxt.length === 0 && <p>No crawl rules found.</p>

View File

@ -10,13 +10,14 @@ max-height: 28rem;
img { img {
border-radius: 6px; border-radius: 6px;
width: 100%; width: 100%;
margin 0.5rem 0;;
} }
`; `;
const ScreenshotCard = (props: { screenshot: string }): JSX.Element => { const ScreenshotCard = (props: { screenshot: string }): JSX.Element => {
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Screenshot</Heading> <Heading as="h3" align="left" color={colors.primary}>Screenshot</Heading>
<img src={props.screenshot} alt="Full page screenshot" /> <img src={props.screenshot} alt="Full page screenshot" />
</Outer> </Outer>
); );

View File

@ -12,7 +12,7 @@ const ServerInfoCard = (info: ServerInfo): JSX.Element => {
const { org, asn, isp, os, ports, ip, loc, type } = info; const { org, asn, isp, os, ports, ip, loc, type } = info;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Server Info</Heading> <Heading as="h3" align="left" color={colors.primary}>Server Info</Heading>
{ org && <Row lbl="Organization" val={org} /> } { org && <Row lbl="Organization" val={org} /> }
{ (isp && isp !== org) && <Row lbl="Service Provider" val={isp} /> } { (isp && isp !== org) && <Row lbl="Service Provider" val={isp} /> }
{ os && <Row lbl="Operating System" val={os} /> } { os && <Row lbl="Operating System" val={os} /> }

View File

@ -40,7 +40,7 @@ const ServerLocationCard = (location: ServerLocation): JSX.Element => {
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Location</Heading> <Heading as="h3" align="left" color={colors.primary}>Location</Heading>
<Row lbl="City" val={`${postCode}, ${city}, ${region}`} /> <Row lbl="City" val={`${postCode}, ${city}, ${region}`} />
<Row lbl="" val=""> <Row lbl="" val="">
<b>Country</b> <b>Country</b>

View File

@ -70,7 +70,7 @@ const ListRow = (props: { list: string[], title: string }) => {
const { list, title } = props; const { list, title } = props;
return ( return (
<> <>
<Heading as="h3" size="small" align="left" color={colors.primary}>{title}</Heading> <Heading as="h3" align="left" color={colors.primary}>{title}</Heading>
{ list.map((entry: string, index: number) => { { list.map((entry: string, index: number) => {
return ( return (
<Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry }</span></Row> <Row key={`${title.toLocaleLowerCase()}-${index}`}><span>{ entry }</span></Row>
@ -84,7 +84,7 @@ const SslCertCard = (props: { sslCert: any }): JSX.Element => {
const { subject, issuer, fingerprint, serialNumber, asn1Curve, nistCurve, valid_to, valid_from, ext_key_usage } = props.sslCert; const { subject, issuer, fingerprint, serialNumber, asn1Curve, nistCurve, valid_to, valid_from, ext_key_usage } = props.sslCert;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>SSL Info</Heading> <Heading as="h3" align="left" color={colors.primary}>SSL Info</Heading>
{ subject && <DataRow lbl="Subject" val={subject?.CN} /> } { subject && <DataRow lbl="Subject" val={subject?.CN} /> }
{ issuer?.O && <DataRow lbl="Issuer" val={issuer.O} /> } { issuer?.O && <DataRow lbl="Issuer" val={issuer.O} /> }

View File

@ -59,7 +59,7 @@ const ServerInfoCard = (whois: Whois): JSX.Element => {
const { created, updated, expires, nameservers } = whois; const { created, updated, expires, nameservers } = whois;
return ( return (
<Outer> <Outer>
<Heading as="h3" size="small" align="left" color={colors.primary}>Who Is Info</Heading> <Heading as="h3" align="left" color={colors.primary}>Who Is Info</Heading>
{ created && <DataRow lbl="Created" val={formatDate(created)} /> } { created && <DataRow lbl="Created" val={formatDate(created)} /> }
{ updated && <DataRow lbl="Updated" val={formatDate(updated)} /> } { updated && <DataRow lbl="Updated" val={formatDate(updated)} /> }
{ expires && <DataRow lbl="Expires" val={formatDate(expires)} /> } { expires && <DataRow lbl="Expires" val={formatDate(expires)} /> }