Skip to content

Commit

Permalink
Use same style for all attribute titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Nov 28, 2024
1 parent c34efe8 commit cc776a7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from '@equinor/eds-core-react'
import { tokens } from '@equinor/eds-tokens'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { AttributeTitleTypography } from 'components/Styles/StyledComponents'
import { Mission } from 'models/Mission'
import styled from 'styled-components'

Expand All @@ -14,9 +14,7 @@ export const MissionAreaDisplay = ({ mission }: { mission: Mission }) => {
const { TranslateText } = useLanguageContext()
return (
<StyledAreaDisplay>
<Typography variant="meta" color={tokens.colors.text.static_icons__tertiary.hex}>
{TranslateText('Area')}
</Typography>
<AttributeTitleTypography>{TranslateText('Area')}</AttributeTitleTypography>
<Typography>{mission.area?.areaName || 'N/A'}</Typography>
</StyledAreaDisplay>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'
import styled from 'styled-components'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { Task } from 'models/Task'
import { tokens } from '@equinor/eds-tokens'
import { AttributeTitleTypography } from 'components/Styles/StyledComponents'

const StyledTagCount = styled.div`
display: flex;
Expand All @@ -31,9 +31,7 @@ export const MissionProgressDisplay = ({ mission }: MissionProps) => {

return (
<StyledTagCount>
<Typography variant="meta" color={tokens.colors.text.static_icons__tertiary.hex}>
{TranslateText('Completed Tasks')}
</Typography>
<AttributeTitleTypography>{TranslateText('Completed Tasks')}</AttributeTitleTypography>
<Typography>
{completedTasks}/{tasks.length}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MissionStatus } from 'models/Mission'
import styled from 'styled-components'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { Icons } from 'utils/icons'
import { AttributeTitleTypography } from 'components/Styles/StyledComponents'

interface StatusProps {
status: MissionStatus
Expand Down Expand Up @@ -77,9 +78,7 @@ export const MissionStatusDisplayWithHeader = ({ status }: StatusProps) => {
const { TranslateText } = useLanguageContext()
return (
<StyledStatusDisplay>
<Typography variant="meta" color={tokens.colors.text.static_icons__tertiary.hex}>
{TranslateText('Status')}
</Typography>
<AttributeTitleTypography>{TranslateText('Status')}</AttributeTitleTypography>
<MissionStatusDisplay status={status} />
</StyledStatusDisplay>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { PressureStatusDisplay } from 'components/Displays/RobotDisplays/PressureStatusDisplay'
import { config } from 'config'
import { RobotType } from 'models/RobotModel'
import { StyledButton } from 'components/Styles/StyledComponents'
import { StyledButton, AttributeTitleTypography } from 'components/Styles/StyledComponents'
import { Icons } from 'utils/icons'

const StyledRobotCard = styled.div`
Expand Down Expand Up @@ -127,7 +127,7 @@ export const RobotCard = ({ robot }: { robot: Robot }) => {
</StyledHeader>
<HorizontalContent>
<VerticalContent>
<Typography variant="caption">{TranslateText('Status')}</Typography>
<AttributeTitleTypography>{TranslateText('Status')}</AttributeTitleTypography>
<RobotStatusChip
status={robot.status}
flotillaStatus={robot.flotillaStatus}
Expand All @@ -138,12 +138,7 @@ export const RobotCard = ({ robot }: { robot: Robot }) => {
{robot.status !== RobotStatus.Offline ? (
<>
<VerticalContent>
<Typography
variant="meta"
style={{ fontSize: 14, color: tokens.colors.text.static_icons__secondary.hex }}
>
{TranslateText('Battery')}
</Typography>
<AttributeTitleTypography>{TranslateText('Battery')}</AttributeTitleTypography>
<BatteryStatusDisplay
batteryLevel={robot.batteryLevel}
batteryWarningLimit={robot.model.batteryWarningThreshold}
Expand All @@ -152,12 +147,7 @@ export const RobotCard = ({ robot }: { robot: Robot }) => {

{robot.pressureLevel !== undefined && robot.pressureLevel !== null && (
<VerticalContent>
<Typography
variant="meta"
style={{ fontSize: 14, color: tokens.colors.text.static_icons__secondary.hex }}
>
{TranslateText('Pressure')}
</Typography>
<AttributeTitleTypography>{TranslateText('Pressure')}</AttributeTitleTypography>
<PressureStatusDisplay
pressure={robot.pressureLevel}
upperPressureWarningThreshold={robot.model.upperPressureWarningThreshold}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/Styles/StyledComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Dialog, Table } from '@equinor/eds-core-react'
import { Button, Dialog, Table, Typography } from '@equinor/eds-core-react'
import { tokens } from '@equinor/eds-tokens'
import styled from 'styled-components'

Expand Down Expand Up @@ -38,6 +38,11 @@ export const StyledPage = styled.div`
}
min-height: calc(100vh - 65px);
`
export const AttributeTitleTypography = styled(Typography)`
variant: meta;
fontsize: 14;
color: ${tokens.colors.text.static_icons__secondary.hex};
`
export const StyledTableCell = styled(Table.Cell)`
background-color: ${tokens.colors.ui.background__default.hex};
`
Expand Down

0 comments on commit cc776a7

Please sign in to comment.