Skip to content

Commit

Permalink
Fix link styling
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Jan 16, 2024
1 parent ed9e518 commit 8c72311
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 48 deletions.
14 changes: 6 additions & 8 deletions components/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const MATLink = ({ query }) => {
const showMATButton = !Array.isArray(query.test_name)

return (
<Flex mt={3} justifyContent='space-between' alignItems='center'>
<Flex mt={3} justifyContent='space-between' alignItems='center' flexWrap="wrap" sx={{gap: 3}}>
<Box>
{showMATButton &&
<NLink href={`/chart/mat?${queryToSearchParams}`}>
Expand All @@ -33,16 +33,14 @@ export const MATLink = ({ query }) => {
</NLink>
}
</Box>
<Box>
<Box mr={3}>
<NLink href={apiUrl}>
{intl.formatMessage({id: 'MAT.Charts.DownloadJSONData'})} <MdOutlineFileDownload style={{verticalAlign: 'bottom'}} size={20} />
</NLink>
</Box>
<Flex sx={{gap: 3}} flexWrap="wrap">
<NLink href={apiUrl}>
{intl.formatMessage({id: 'MAT.Charts.DownloadJSONData'})} <MdOutlineFileDownload style={{verticalAlign: 'bottom'}} size={20} />
</NLink>
<NLink href={`${apiUrl}&format=CSV`}>
{intl.formatMessage({id: 'MAT.Charts.DownloadCSVData'})} <MdOutlineFileDownload style={{verticalAlign: 'bottom'}} size={20} />
</NLink>
</Box>
</Flex>
</Flex>
)
}
Expand Down
15 changes: 9 additions & 6 deletions components/measurement/CommonSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ const SummaryContainer = styled(Box)`
color: white;
`

const StyledSummaryItemLabel = styled(Text)`
font-weight: 600;
const StyledLink = styled(NLink)`
color: white;
&:hover {
color: white;
}
`

const CommonSummary = ({
Expand Down Expand Up @@ -62,7 +65,7 @@ const CommonSummary = ({
{hero}
<Flex mt={2} sx={{textDecoration:'underline'}}>
<Box width={[1, 1, 1/2]}>
<NLink href={`/country/${countryCode}`}>
<StyledLink href={`/country/${countryCode}`}>
<Flex alignItems='center'>
<Box mr={2}>
<Flag countryCode={countryCode} size={33} />
Expand All @@ -71,11 +74,11 @@ const CommonSummary = ({
{country}
</Box>
</Flex>
</NLink>
</StyledLink>
<Text fontSize={1}>
<NLink href={`/as/${network}`}>
<StyledLink href={`/as/${network}`}>
<Text mb={2} mt={2}>{network} {networkName}</Text>
</NLink>
</StyledLink>
</Text>
</Box>
</Flex>
Expand Down
45 changes: 21 additions & 24 deletions components/measurement/nettests/WebConnectivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,19 @@ const validateMeasurement = (measurement) => {

const getSearchHref = (input) => (`${process.env.NEXT_PUBLIC_EXPLORER_URL}/search?input=${input}`)

const StyledLink = styled(NLink)`
direction: ltr;
display: inline;
`

const StyledStatusInfoLink = styled(NLink)`
color: white;
text-decoration: underline;
&:hover {
color: white;
}
`

const WebConnectivityDetails = ({
isConfirmed,
isAnomaly,
Expand Down Expand Up @@ -349,7 +362,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.Failed'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
network: probe_asn,
country
}}
Expand All @@ -360,7 +373,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.ConfirmedBlocked'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
network: probe_asn,
country
}}
Expand All @@ -384,7 +397,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.Anomaly'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
'link-to-docs': (string) => (<a href="https://ooni.org/support/faq/#why-do-false-positives-occur">{string}</a>),
network: probe_asn,
country,
Expand All @@ -409,7 +422,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.Accessible'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
network: probe_asn,
country
}}
Expand All @@ -432,7 +445,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.Down'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
network: probe_asn,
country
}}
Expand All @@ -456,7 +469,7 @@ const WebConnectivityDetails = ({
id='Measurement.SummaryText.Websites.Failed'
values={{
date,
WebsiteURL: <Box dir='ltr'><NLink href={getSearchHref(input)}>{input}</NLink></Box>,
WebsiteURL: <StyledLink href={getSearchHref(input)}>{input}</StyledLink>,
network: probe_asn,
country
}}
Expand Down Expand Up @@ -489,9 +502,9 @@ const WebConnectivityDetails = ({
status: status,
statusInfo: <StatusInfo
title={
<NLink href={`/domain/${hostname}`}>
<StyledStatusInfoLink href={`/domain/${hostname}`}>
{input}
</NLink>
</StyledStatusInfoLink>
}
message={reason}
/>,
Expand Down Expand Up @@ -603,21 +616,5 @@ const WebConnectivityDetails = ({
)
}

WebConnectivityDetails.propTypes = {
country: PropTypes.string.isRequired,
input: PropTypes.any,
isAnomaly: PropTypes.bool.isRequired,
isConfirmed: PropTypes.bool.isRequired,
isFailure: PropTypes.bool.isRequired,
measurement: PropTypes.object.isRequired,
probe_asn: PropTypes.any,
render: PropTypes.func,
scores: PropTypes.shape({
analysis: PropTypes.shape({
blocking_type: PropTypes.any
})
}),
measurement_start_time: PropTypes.any
}

export default WebConnectivityDetails
7 changes: 2 additions & 5 deletions components/search/ResultsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ ASNBox.propTypes = {
asn: PropTypes.string
}

// XXX add this to the design system
const StyledViewDetailsLink = styled.span`
const StyledViewDetailsLink = styled(NLink)`
cursor: pointer;
text-decoration: none;
color: ${props => props.theme.colors.blue5};
Expand All @@ -234,9 +233,7 @@ const ViewDetailsLink = ({measurementUid, children}) => {
let href = `/m/${measurementUid}`

return (
<NLink href={href}>
<StyledViewDetailsLink>{children}</StyledViewDetailsLink>
</NLink>
<StyledViewDetailsLink href={href}>{children}</StyledViewDetailsLink>
)
}

Expand Down
4 changes: 2 additions & 2 deletions pages/api/cloudflare.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios from 'axios'
import { LRUCache } from 'lru-cache'
import dayjs from 'services/dayjs'
import LRU from 'lru-cache'

const CACHE_MAX_SIZE = process.env.CACHE_MAX_SIZE || 100
const CACHE_MAX_AGE_IN_S = process.env.CACHE_MAX_AGE_IN_S || 60 * 60

const context = {
cache: new LRU({
cache: new LRUCache({
max: CACHE_MAX_SIZE,
ttl: CACHE_MAX_AGE_IN_S
})
Expand Down
6 changes: 3 additions & 3 deletions pages/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import styled from 'styled-components'

import NavBar from '/components/NavBar'

import dynamic from 'next/dynamic'
import { sortByKey } from '../utils'
import FormattedMarkdown from '/components/FormattedMarkdown'
import FilterSidebar, { queryToFilterMap } from '/components/search/FilterSidebar'
// import { Loader } from '/components/search/Loader'
import ResultsList from '/components/search/ResultsList'

const Loader = dynamic(() => import('/components/search/Loader'), { ssr: false })

import dynamic from 'next/dynamic'
import { sortByKey } from '../utils'


export const getServerSideProps = async ({query}) => {
// By default, on '/search' show measurements published until today
Expand Down

0 comments on commit 8c72311

Please sign in to comment.