-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(new-ui): implement new suite title and basics of visual checks …
…mode
- Loading branch information
Showing
40 changed files
with
569 additions
and
195 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
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,13 @@ | ||
import actionNames from '@/static/modules/action-names'; | ||
import {Action} from '@/static/modules/actions/types'; | ||
|
||
export type VisualChecksPageSetCurrentNamedImageAction = Action<typeof actionNames.VISUAL_CHECKS_PAGE_SET_CURRENT_NAMED_IMAGE, { | ||
namedImageId: string; | ||
}>; | ||
|
||
export const visualChecksPageSetCurrentNamedImage = (namedImageId: string): VisualChecksPageSetCurrentNamedImageAction => { | ||
return {type: actionNames.VISUAL_CHECKS_PAGE_SET_CURRENT_NAMED_IMAGE, payload: {namedImageId}}; | ||
}; | ||
|
||
export type VisualChecksPageAction = | ||
| VisualChecksPageSetCurrentNamedImageAction; |
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,13 @@ | ||
import {State} from '@/static/new-ui/types/store'; | ||
import actionNames from '@/static/modules/action-names'; | ||
import {applyStateUpdate} from '@/static/modules/utils/state'; | ||
import {VisualChecksPageAction} from '@/static/modules/actions'; | ||
|
||
export default (state: State, action: VisualChecksPageAction): State => { | ||
switch (action.type) { | ||
case actionNames.VISUAL_CHECKS_PAGE_SET_CURRENT_NAMED_IMAGE: | ||
return applyStateUpdate(state, {app: {visualChecksPage: {currentNamedImageId: action.payload.namedImageId}}}) as State; | ||
default: | ||
return state; | ||
} | ||
}; |
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,11 @@ | ||
.card { | ||
background-color: #fff; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.hint { | ||
color: var(--g-color-private-black-400); | ||
font-weight: 500; | ||
} |
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,15 @@ | ||
import classNames from 'classnames'; | ||
import React, {ReactNode} from 'react'; | ||
|
||
import {Card, CardProps} from '.'; | ||
import styles from './TextHintCard.module.css'; | ||
|
||
interface TextHintCardProps extends CardProps { | ||
hint: string; | ||
} | ||
|
||
export function TextHintCard(props: TextHintCardProps): ReactNode { | ||
return <Card className={classNames(styles.card, props.className)}> | ||
<span className={styles.hint}>{props.hint}</span> | ||
</Card>; | ||
} |
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,8 @@ | ||
.card { | ||
background-color: #fff; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 0 20px 20px 20px; | ||
overflow: scroll; | ||
position: relative; | ||
} |
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,9 @@ | ||
import classNames from 'classnames'; | ||
import React, {ReactNode} from 'react'; | ||
|
||
import {Card, CardProps} from '.'; | ||
import styles from './UiCard.module.css'; | ||
|
||
export function UiCard(props: CardProps): ReactNode { | ||
return <Card className={classNames(styles.card, props.className)}>{props.children}</Card>; | ||
} |
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,78 @@ | ||
.container { | ||
display: flex; | ||
align-items: baseline; | ||
justify-content: space-between; | ||
} | ||
|
||
@container (max-width: 500px) { | ||
.container { | ||
flex-wrap: wrap-reverse; | ||
} | ||
} | ||
|
||
.breadcrumbs { | ||
font-weight: 500; | ||
color: var(--g-color-private-black-400); | ||
font-size: 15px; | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.separator { | ||
margin: 0 4px; | ||
display: inline-block; | ||
width: 16px; | ||
position: relative; | ||
} | ||
|
||
.invisible-space { | ||
position: absolute; | ||
z-index: -1; | ||
left: 0; | ||
} | ||
|
||
.content { | ||
margin-top: 8px; | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: 8px; | ||
} | ||
|
||
.title-container { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
column-gap: 8px; | ||
row-gap: 4px; | ||
} | ||
|
||
.labels-container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 8px; | ||
} | ||
|
||
.label:global(.g-label_theme_danger) { | ||
--_--text-color: var(--color-pink-600); | ||
--_--bg-color: var(--color-pink-100); | ||
} | ||
|
||
.label :global(.g-label__content) { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: nowrap; | ||
gap: 4px; | ||
font-size: 15px; | ||
} | ||
|
||
.pagination-container { | ||
display: flex; | ||
align-items: baseline; | ||
gap: 4px; | ||
} | ||
|
||
.counter { | ||
font-weight: 500; | ||
color: var(--g-color-private-black-400); | ||
font-size: 15px; | ||
} |
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,68 @@ | ||
import classNames from 'classnames'; | ||
import React, {ReactNode} from 'react'; | ||
import {Button, Icon, Label} from '@gravity-ui/uikit'; | ||
import {Camera, ChevronRight, PlanetEarth, ChevronUp, ChevronDown} from '@gravity-ui/icons'; | ||
|
||
import {TestStatus} from '@/constants'; | ||
import styles from './index.module.css'; | ||
|
||
interface SuiteTitleProps { | ||
className?: string; | ||
} | ||
|
||
interface SuiteTitlePropsInternal extends SuiteTitleProps { | ||
suitePath: string[]; | ||
browserName: string; | ||
stateName?: string; | ||
imageStatus?: TestStatus; | ||
index: number; | ||
totalItems: number; | ||
onPrevious: () => void; | ||
onNext: () => void; | ||
} | ||
|
||
export function SuiteTitle(props: SuiteTitlePropsInternal): ReactNode { | ||
const suiteName = props.suitePath[props.suitePath.length - 1]; | ||
const suitePath = props.suitePath.slice(0, -1); | ||
|
||
let stateNameLabelTheme: 'normal' | 'danger' | 'success' = 'normal'; | ||
if (props.imageStatus === TestStatus.FAIL || props.imageStatus === TestStatus.ERROR) { | ||
stateNameLabelTheme = 'danger'; | ||
} else if (props.imageStatus === TestStatus.SUCCESS) { | ||
stateNameLabelTheme = 'success'; | ||
} | ||
|
||
return <div className={classNames(styles.container, props.className)}> | ||
<div className={styles.content}> | ||
<div className={classNames(styles.breadcrumbs)}> | ||
{suitePath.map((item, index) => ( | ||
<div key={index} className={styles.breadcrumbsItem}> | ||
{item} | ||
{index !== suitePath.length - 1 && | ||
<div className={styles.separator}> | ||
<ChevronRight height={11}/> | ||
<span className={styles.invisibleSpace}> </span> | ||
</div>} | ||
</div> | ||
))} | ||
</div> | ||
<div className={styles.titleContainer}> | ||
<h2 className={classNames('text-display-1')}> | ||
{suiteName ?? 'Unknown Suite'} | ||
</h2> | ||
<div className={styles.labelsContainer}> | ||
<Label theme={'normal'} size={'xs'} className={styles.label}><PlanetEarth/>{props.browserName} | ||
</Label> | ||
{props.stateName && <Label theme={stateNameLabelTheme} size={'xs'} className={classNames(styles.label)}><Camera/>{props.stateName}</Label>} | ||
</div> | ||
</div> | ||
</div> | ||
<div className={styles.paginationContainer}> | ||
<span className={styles.counter}>{props.index === -1 ? '–' : props.index + 1}/{props.totalItems}</span> | ||
<Button view={'flat'} disabled={props.index === -1 || props.index === 0} onClick={props.onPrevious}><Icon | ||
data={ChevronUp}/></Button> | ||
<Button view={'flat'} disabled={props.index === -1 || props.index === props.totalItems - 1} onClick={props.onNext}><Icon | ||
data={ChevronDown}/></Button> | ||
</div> | ||
</div>; | ||
} |
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
3 changes: 3 additions & 0 deletions
3
lib/static/new-ui/features/suites/components/BrowsersSelect/BrowserIcon.module.css
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,3 @@ | ||
.icon { | ||
opacity: .6; | ||
} |
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
Oops, something went wrong.