diff --git a/src/components/Results/HostNames.tsx b/src/components/Results/HostNames.tsx new file mode 100644 index 0000000..60db257 --- /dev/null +++ b/src/components/Results/HostNames.tsx @@ -0,0 +1,48 @@ + +import styled from 'styled-components'; +import { HostNames } from 'utils/result-processor'; +import colors from 'styles/colors'; +import Card from 'components/Form/Card'; +import Heading from 'components/Form/Heading'; + +const Outer = styled(Card)` + max-width: 24rem; +`; + +const Row = styled.div` + display: flex; + justify-content: space-between; + padding: 0.25rem; + &:not(:last-child) { border-bottom: 1px solid ${colors.primary}; } + span:first-child { font-weight: bold; } +`; + +const HostListSection = (props: { list: string[], title: string }) => { + const { list, title } = props; + return ( + <> + {title} + { list.map((entry: string, index: number) => { + return ( + { entry } + )} + )} + +); +} + +const HostNamesCard = (props: { hosts: HostNames }): JSX.Element => { + const hosts = props.hosts; + return ( + + { hosts.domains.length > 0 && + + } + { hosts.hostnames.length > 0 && + + } + + ); +} + +export default HostNamesCard; diff --git a/src/components/Results/ServerInfo.tsx b/src/components/Results/ServerInfo.tsx new file mode 100644 index 0000000..376d7b2 --- /dev/null +++ b/src/components/Results/ServerInfo.tsx @@ -0,0 +1,49 @@ + +import styled from 'styled-components'; +import { ServerInfo } from 'utils/result-processor'; +import colors from 'styles/colors'; +import Card from 'components/Form/Card'; +import Heading from 'components/Form/Heading'; + +const Outer = styled(Card)` + max-width: 24rem; +`; + +const Row = styled.div` + display: flex; + justify-content: space-between; + padding: 0.25rem; + &:not(:last-child) { border-bottom: 1px solid ${colors.primary}; } + span.lbl { font-weight: bold; } + span.val { + max-width: 200px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +`; + +const DataRow = (props: { lbl: string, val: string }) => { + const { lbl, val } = props; + return ( + + {lbl} + {val} + + ); +}; + +const ServerInfoCard = (info: ServerInfo): JSX.Element => { + const { org, asn, isp, os } = info; + return ( + + Server Info + { org && } + { (isp && isp !== org) && } + { os && } + { asn && } + + ); +} + +export default ServerInfoCard; diff --git a/src/components/Results/ServerLocation.tsx b/src/components/Results/ServerLocation.tsx index 9bbcaee..cbbdb50 100644 --- a/src/components/Results/ServerLocation.tsx +++ b/src/components/Results/ServerLocation.tsx @@ -1,26 +1,82 @@ import styled from 'styled-components'; -import { ServerLocation } from 'utils/result-processer'; +import { ServerLocation } from 'utils/result-processor'; import colors from 'styles/colors'; import Card from 'components/Form/Card'; +import Heading from 'components/Form/Heading'; +import LocationMap from 'components/misc/LocationMap'; +import Flag from 'components/misc/Flag'; +import { TextSizes } from 'styles/typography'; + +const Outer = styled(Card)` + max-width: 24rem; +`; const Row = styled.div` - border-bottom: 1px solid ${colors.primary}; display: flex; justify-content: space-between; + padding: 0.25rem; + &:not(:last-child) { border-bottom: 1px solid ${colors.primary}; } +`; + +const RowLabel = styled.span` + font-weight: bold; +`; + +const RowValue = styled.span` + display: flex; + img { margin-left: 0.5rem; } +`; + +const SmallText = styled.span` + opacity: 0.5; + font-size: ${TextSizes.xSmall}; + text-align: right; + display: block; +`; + +const MapRow = styled(Row)` + flex-direction: column; `; const ServerLocationCard = (location: ServerLocation): JSX.Element => { - const { city, regionCode, countryCode, countryName, coords } = location; + const { + city, region, country, + postCode, countryCode, coords, + isp, timezone, languages, currency, currencyCode, + } = location; return ( - - - Location - { city }, { countryName } - - + + Location + + City + + {postCode}, { city }, { region } + + + + Country + + {country} + { countryCode && } + + + { timezone && + Timezone{timezone} + } + { languages && + Languages{languages} + } + { currency && + Currency{currency} ({currencyCode}) + } + + + Latitude: {coords.latitude}, Longitude: {coords.longitude} + + ); }