-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): indicate tabs with info in trigger (#3565)
- Loading branch information
Showing
13 changed files
with
119 additions
and
51 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 |
---|---|---|
@@ -1,46 +1,42 @@ | ||
import ResourceCardActions from 'components/ResourceCard/ResourceCardActions'; | ||
import {useDashboard} from 'providers/Dashboard/Dashboard.provider'; | ||
import * as S from './TestHeader.styled'; | ||
import VariableSetSelector from '../VariableSetSelector/VariableSetSelector'; | ||
|
||
interface IProps { | ||
description: string; | ||
id: string; | ||
shouldEdit: boolean; | ||
onBack(): void; | ||
onEdit(): void; | ||
onDelete(): void; | ||
onDuplicate(): void; | ||
title: string; | ||
runButton: React.ReactNode; | ||
} | ||
|
||
const TestHeader = ({description, id, shouldEdit, onEdit, onDelete, onDuplicate, title, runButton}: IProps) => { | ||
const {navigate} = useDashboard(); | ||
|
||
return ( | ||
<S.Container $isWhite> | ||
<S.Section> | ||
<a onClick={() => navigate(-1)} data-cy="test-header-back-button"> | ||
<S.BackIcon /> | ||
</a> | ||
<div> | ||
<S.Title data-cy="test-details-name">{title}</S.Title> | ||
<S.Text>{description}</S.Text> | ||
</div> | ||
</S.Section> | ||
<S.Section> | ||
<VariableSetSelector /> | ||
{runButton} | ||
<ResourceCardActions | ||
id={id} | ||
onDuplicate={onDuplicate} | ||
onDelete={onDelete} | ||
onEdit={onEdit} | ||
shouldEdit={shouldEdit} | ||
/> | ||
</S.Section> | ||
</S.Container> | ||
); | ||
}; | ||
const TestHeader = ({description, id, shouldEdit, onBack, onEdit, onDelete, onDuplicate, title, runButton}: IProps) => ( | ||
<S.Container $isWhite> | ||
<S.Section> | ||
<a onClick={onBack} data-cy="test-header-back-button"> | ||
<S.BackIcon /> | ||
</a> | ||
<div> | ||
<S.Title data-cy="test-details-name">{title}</S.Title> | ||
<S.Text>{description}</S.Text> | ||
</div> | ||
</S.Section> | ||
<S.Section> | ||
<VariableSetSelector /> | ||
{runButton} | ||
<ResourceCardActions | ||
id={id} | ||
onDuplicate={onDuplicate} | ||
onDelete={onDelete} | ||
onEdit={onEdit} | ||
shouldEdit={shouldEdit} | ||
/> | ||
</S.Section> | ||
</S.Container> | ||
); | ||
|
||
export default TestHeader; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {Badge as AntdBadge, Typography} from 'antd'; | ||
import styled from 'styled-components'; | ||
|
||
export const Badge = styled(AntdBadge)` | ||
.ant-badge-status-text { | ||
margin-left: 0; | ||
} | ||
`; | ||
|
||
export const Text = styled(Typography.Text)` | ||
color: ${({theme}) => theme.color.primary}; | ||
`; |
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,24 @@ | ||
import {useTheme} from 'styled-components'; | ||
import * as S from './TriggerTab.styled'; | ||
|
||
interface IProps { | ||
hasContent?: boolean; | ||
label: string; | ||
totalItems?: number; | ||
} | ||
|
||
const TriggerTab = ({hasContent, label, totalItems}: IProps) => { | ||
const { | ||
color: {primary}, | ||
} = useTheme(); | ||
|
||
return ( | ||
<div> | ||
{`${label} `} | ||
{!!totalItems && <S.Text>({totalItems})</S.Text>} | ||
{hasContent && <S.Badge color={primary} />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default TriggerTab; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './TriggerTab'; |
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
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