Skip to content

Commit bc6c413

Browse files
committed
Merge branch 'develop' into feat/mandatory-tags-v2
2 parents 8e56de5 + 4804744 commit bc6c413

File tree

12 files changed

+174
-77
lines changed

12 files changed

+174
-77
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.2.7-beta-2",
3+
"version": "1.2.9",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -66,6 +66,8 @@
6666
"react-toastify": "9.1.3",
6767
"sharp": "^0.33.5",
6868
"svgo": "^3.3.2",
69+
"monaco-editor": "0.44.0",
70+
"monaco-yaml": "5.1.1",
6971
"typescript": "5.5.4",
7072
"vite": "5.4.11",
7173
"vite-plugin-dts": "4.0.3",
@@ -80,8 +82,6 @@
8082
"@rjsf/validator-ajv8": "^5.13.3",
8183
"@typeform/embed-react": "2.20.0",
8284
"dompurify": "^3.0.2",
83-
"monaco-editor": "0.44.0",
84-
"monaco-yaml": "5.1.1",
8585
"react": "^17.0.2",
8686
"react-dom": "^17.0.2",
8787
"react-draggable": "^4.4.5",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 { OptionType } from '@Common/Types'
18+
import StyledRadioGroup from '../RadioGroup/RadioGroup'
19+
import { SegmentedControlProps, SegmentedControlVariant } from './types'
20+
21+
const SegmentedControl = ({
22+
tabs,
23+
initialTab,
24+
onChange,
25+
tooltips,
26+
disabled = false,
27+
rootClassName = '',
28+
name,
29+
variant = SegmentedControlVariant.WHITE_ON_GRAY,
30+
}: SegmentedControlProps) => (
31+
<StyledRadioGroup
32+
className={`${variant} ${rootClassName}`}
33+
onChange={onChange}
34+
initialTab={initialTab}
35+
name={name}
36+
disabled={disabled}
37+
>
38+
{tabs.map((tab: OptionType, index) => (
39+
<StyledRadioGroup.Radio
40+
value={tab.value}
41+
key={tab.value}
42+
className="fs-12 cn-7 fw-6 lh-20"
43+
showTippy={!!tooltips?.[index]}
44+
tippyContent={tooltips?.[index] ?? ''}
45+
dataTestId={`${name}-${tab.value}`}
46+
>
47+
{tab.label}
48+
</StyledRadioGroup.Radio>
49+
))}
50+
</StyledRadioGroup>
51+
)
52+
53+
export default SegmentedControl

src/Common/SegmentedControl/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { type SegmentedControlProps, SegmentedControlVariant } from './types'
2+
export { default as SegmentedControl } from './SegmentedControl.component'

0 commit comments

Comments
 (0)