-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: for gitlab use delivered values and omit link for other language…
… category
- Loading branch information
1 parent
69b7260
commit a2e7c84
Showing
3 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2023 dv4all | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import SearchIcon from '@mui/icons-material/Search' | ||
import Link from 'next/link' | ||
import {ssrSoftwareUrl} from '~/utils/postgrestUrl' | ||
|
||
type AboutLanguageItemProps = { | ||
language: string, | ||
val: number, | ||
pct: number | ||
} | ||
|
||
export default function AboutLanguageItem(props: AboutLanguageItemProps) { | ||
const {language, pct} = props | ||
|
||
if (language.toLowerCase() === 'other') { | ||
// Other item has no search link | ||
return ( | ||
<li> | ||
<div className="flex justify-between"> | ||
<span>{language} {pct}%</span> | ||
</div> | ||
<div | ||
className="bg-primary" | ||
style={{ | ||
width: `${pct}%`, | ||
height: '0.5rem', | ||
opacity: 0.5 | ||
}}> | ||
</div> | ||
</li> | ||
) | ||
} | ||
|
||
// construct url | ||
const url = ssrSoftwareUrl({prog_lang: [language]}) | ||
|
||
return ( | ||
<li> | ||
<div className="flex justify-between"> | ||
<span>{language} {pct}%</span> | ||
<Link | ||
title={`Click to filter for software using ${language}`} | ||
href={url} | ||
passHref | ||
> | ||
<SearchIcon sx={{ | ||
marginRight: '0.5rem', | ||
color:'text.secondary' | ||
}} /> | ||
</Link> | ||
</div> | ||
<div | ||
className="bg-primary" | ||
style={{ | ||
width: `${pct}%`, | ||
height: '0.5rem', | ||
opacity: 0.5 | ||
}}> | ||
</div> | ||
</li> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters