Skip to content

Commit 6692e2f

Browse files
committed
feat: add git provider icons, replace instances of these icons used as background
1 parent 2435eef commit 6692e2f

File tree

8 files changed

+123
-10
lines changed

8 files changed

+123
-10
lines changed

src/Assets/IconV2/ic-bitbucket.svg

Lines changed: 30 additions & 0 deletions
Loading

src/Assets/IconV2/ic-git.svg

Lines changed: 17 additions & 0 deletions
Loading

src/Assets/IconV2/ic-github.svg

Lines changed: 21 additions & 0 deletions
Loading

src/Assets/IconV2/ic-gitlab.svg

Lines changed: 31 additions & 0 deletions
Loading

src/Common/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
export const getContainerRegistryIcon = (registryValue: string): JSX.Element => (
18-
<div className={`dc__registry-icon dc__git-logo ${registryValue}`} />
18+
<div className={`dc__registry-icon ${registryValue}`} />
1919
)

src/Shared/Components/CICDHistory/Sidebar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { CiPipelineSourceConfig } from './CiPipelineSourceConfig'
4444
import { HISTORY_LABEL, FILTER_STYLE } from './constants'
4545
import { statusColor as colorMap } from '../../constants'
4646
import { DeploymentStatus } from '../StatusComponent'
47+
import { Icon } from '../Icon'
4748

4849
const SummaryTooltipCard = React.memo(
4950
({
@@ -89,7 +90,7 @@ const SummaryTooltipCard = React.memo(
8990
</div>
9091
) : (
9192
<>
92-
<div className="dc__git-logo"> </div>
93+
<Icon name="ic-git" size={24} color={null} />
9394
<div className="flex left column">
9495
<a
9596
href={createGitCommitUrl(gitMaterialUrl, gitDetail.Commit)}

src/Shared/Components/GitCommitInfoGeneric/GitMaterialInfoHeader.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { GitProviderType } from '@Common/Constants'
1718
import { CiPipelineSourceConfig } from '../CICDHistory/CiPipelineSourceConfig'
19+
import { Icon, IconName } from '../Icon'
1820
import './gitCommitInfoGeneric.scss'
1921

2022
/* eslint-disable react/prop-types */
21-
function getGitIcon(repoUrl) {
22-
// eslint-disable-next-line no-restricted-syntax
23-
for (const gitProvider of ['github', 'gitlab', 'bitbucket']) {
24-
if (repoUrl.includes(gitProvider)) {
25-
return `${gitProvider}`
26-
}
23+
const getGitIconName = (repoUrl: string): IconName => {
24+
if (repoUrl.includes(GitProviderType.GITHUB)) {
25+
return 'ic-github'
2726
}
28-
return 'git'
27+
if (repoUrl.includes(GitProviderType.GITLAB)) {
28+
return 'ic-gitlab'
29+
}
30+
if (repoUrl.includes(GitProviderType.BITBUCKET)) {
31+
return 'ic-bitbucket'
32+
}
33+
return 'ic-git'
2934
}
3035

3136
const GitMaterialInfoHeader = ({
@@ -46,7 +51,7 @@ const GitMaterialInfoHeader = ({
4651
className="git-commit-info-generic__header px-16 py-12 dc__box-shadow fs-12 fw-6 dc__gap-4"
4752
style={style}
4853
>
49-
<div className={getGitIcon(repoUrl)} />
54+
<Icon name={getGitIconName(repoUrl)} size={20} color={null} />
5055
<div className="flex left left dc__gap-4 fs-13">
5156
<div
5257
className="repo cn-9 fw-6 dc__mxw-250 dc__ellipsis-right"

src/Shared/Components/Icon/Icon.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
// NOTE: This file is auto-generated. Do not edit directly. Run the script `npm run generate-icon` to update.
22

33
import { ReactComponent as ICAborted } from '@IconsV2/ic-aborted.svg'
4+
import { ReactComponent as ICBitbucket } from '@IconsV2/ic-bitbucket.svg'
45
import { ReactComponent as ICCancelled } from '@IconsV2/ic-cancelled.svg'
56
import { ReactComponent as ICCircleLoader } from '@IconsV2/ic-circle-loader.svg'
67
import { ReactComponent as ICClock } from '@IconsV2/ic-clock.svg'
78
import { ReactComponent as ICCloseSmall } from '@IconsV2/ic-close-small.svg'
89
import { ReactComponent as ICError } from '@IconsV2/ic-error.svg'
910
import { ReactComponent as ICFailure } from '@IconsV2/ic-failure.svg'
11+
import { ReactComponent as ICGit } from '@IconsV2/ic-git.svg'
12+
import { ReactComponent as ICGithub } from '@IconsV2/ic-github.svg'
13+
import { ReactComponent as ICGitlab } from '@IconsV2/ic-gitlab.svg'
1014
import { ReactComponent as ICHeartGreen } from '@IconsV2/ic-heart-green.svg'
1115
import { ReactComponent as ICHeartRedAnimated } from '@IconsV2/ic-heart-red-animated.svg'
1216
import { ReactComponent as ICHeartRed } from '@IconsV2/ic-heart-red.svg'
@@ -25,12 +29,16 @@ import { IconBaseProps } from './types'
2529

2630
export const iconMap = {
2731
'ic-aborted': ICAborted,
32+
'ic-bitbucket': ICBitbucket,
2833
'ic-cancelled': ICCancelled,
2934
'ic-circle-loader': ICCircleLoader,
3035
'ic-clock': ICClock,
3136
'ic-close-small': ICCloseSmall,
3237
'ic-error': ICError,
3338
'ic-failure': ICFailure,
39+
'ic-git': ICGit,
40+
'ic-github': ICGithub,
41+
'ic-gitlab': ICGitlab,
3442
'ic-heart-green': ICHeartGreen,
3543
'ic-heart-red-animated': ICHeartRedAnimated,
3644
'ic-heart-red': ICHeartRed,

0 commit comments

Comments
 (0)