Skip to content

Commit e627669

Browse files
authored
Merge pull request #495 from devtron-labs/feat/migrate-workflow-options
feat: move workflow options modal and related components in common-lib
2 parents f9c0ec7 + 5289275 commit e627669

17 files changed

+623
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.5.4",
3+
"version": "1.5.5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-source-build.svg

Lines changed: 22 additions & 0 deletions
Loading

src/Assets/Icon/ic-source-job.svg

Lines changed: 26 additions & 0 deletions
Loading
Lines changed: 24 additions & 0 deletions
Loading

src/Assets/Icon/ic-source-webhook.svg

Lines changed: 22 additions & 0 deletions
Loading

src/Assets/Img/change-source.png

28.3 KB
Loading
29.7 KB
Loading
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import Tippy from '@tippyjs/react'
18+
import { ConditionalWrap } from '@Common/Helper'
19+
import { SourceTypeCardProps } from './types'
20+
21+
const SourceTypeCard = ({
22+
title,
23+
subtitle,
24+
image,
25+
alt,
26+
dataTestId,
27+
type,
28+
handleCardAction,
29+
disableInfo,
30+
isDisabled = false,
31+
}: Readonly<SourceTypeCardProps>) => {
32+
const disableCard = !!disableInfo || isDisabled
33+
const renderTippy = (children) => (
34+
<Tippy className="default-tt w-200" placement="top" content={disableInfo} arrow={false}>
35+
{/* Since in disabled state Tippy does'nt work */}
36+
<span>{children}</span>
37+
</Tippy>
38+
)
39+
40+
return (
41+
<ConditionalWrap wrap={renderTippy} condition={!!disableInfo}>
42+
<div className={disableCard ? 'cursor-not-allowed dc__position-rel' : ''}>
43+
<div
44+
className={`flexbox p-12 dc__gap-12 dc__align-self-stretch br-4 dc__border-n1 bg__primary dc__hover-n50 ${
45+
disableCard ? 'dc__disable-click dc__opacity-0_5' : ''
46+
}`}
47+
role="button"
48+
data-testid={dataTestId}
49+
data-pipeline-type={type}
50+
onClick={handleCardAction}
51+
onKeyDown={handleCardAction}
52+
tabIndex={disableCard ? -1 : 0}
53+
aria-disabled={disableCard}
54+
>
55+
<div>
56+
<img src={image} className="flex br-8" alt={alt} width={40} height={40} />
57+
</div>
58+
59+
<div className="flexbox-col pr-12">
60+
{/* TITLE */}
61+
<p className="m-0 cn-9 fs-13 fw-6 lh-20">{title}</p>
62+
63+
{/* SUBTITLE */}
64+
<p className="m-0 cn-7 fs-12 fw-4 lh-16">{subtitle}</p>
65+
</div>
66+
</div>
67+
</div>
68+
</ConditionalWrap>
69+
)
70+
}
71+
72+
export default SourceTypeCard

0 commit comments

Comments
 (0)