Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Oct 6, 2023
1 parent d06d3f8 commit 60d77e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 43 deletions.
29 changes: 14 additions & 15 deletions apps/charterafrica/src/components/Tool/Tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,20 @@ const Tool = React.forwardRef(function Tool(props, ref) {
<RichTypography color="neutral.dark" variant="h2SemiBold">
{name}
</RichTypography>
<Button
component={externalLink?.href ? Link : undefined}
href={externalLink?.href}
>
<SvgIcon
inheritViewBox
component={ExternalLink}
sx={{
color: "text.primary",
fill: "none",
height: 32,
width: 32,
}}
/>
</Button>
{externalLink?.href ? (
<Link href={externalLink?.href}>
<SvgIcon
inheritViewBox
component={ExternalLink}
sx={{
color: "text.primary",
fill: "none",
height: 32,
width: 32,
}}
/>
</Link>
) : null}
</Box>
</Grid>
<Grid item>
Expand Down
11 changes: 0 additions & 11 deletions apps/charterafrica/src/components/Tool/Tool.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ exports[`<Tool /> renders unchanged 1`] = `
>
Tool Name
</div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium css-18jkoo-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<div
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-mg30as-MuiSvgIcon-root"
focusable="false"
/>
</button>
</div>
</div>
<div
Expand Down
19 changes: 2 additions & 17 deletions apps/charterafrica/src/lib/data/common/processPageTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ const queryBuilder = (query) => {
return where;
};

const getRepoLink = (tool) => {
if (!tool.externalId) {
return null;
}
switch (tool.source) {
case "github":
return `https://github.com/${tool.externalId.replace(
"https://github.com/",
"",
)}`;
default:
return "";
}
};

async function processPageSingleTool(page, api, context) {
const { params, locale } = context;
const { slug: collection } = page;
Expand Down Expand Up @@ -85,11 +70,11 @@ async function processPageSingleTool(page, api, context) {
...tool,
slug: "tool",
contribute: {
href: getRepoLink(tool),
href: tool.repoLink,
label: filterLabels.contribute,
},
goToRepo: {
href: getRepoLink(tool),
href: tool.repoLink,
label: filterLabels.goToRepo,
},
topicLabel: filterLabels.theme,
Expand Down

0 comments on commit 60d77e9

Please sign in to comment.