Skip to content

Commit

Permalink
feat(board): made line icon for view (#1112)
Browse files Browse the repository at this point in the history
* feat(board): created line component and transportmode component

* fix(line): changed the sizes of the icons

* style(board): changed height of the line icons

* style(lineicon): changed sizes to em and removed unnecessary css

* chore(transporticon): deleted css file in transporticon

* chore(transporticon): removed unused import
  • Loading branch information
vildeopp authored Jul 7, 2023
1 parent 245d3c4 commit 935e3a6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
19 changes: 13 additions & 6 deletions next-tavla/src/Board/scenarios/Table/components/Line/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNonNullContext } from 'hooks/useNonNullContext'
import { getPresentation } from 'Board/utils/colors'
import { TransportIcon } from '../TransportIcon'
import { DepartureContext } from '../../contexts'
import classes from './styles.module.css'

function Line() {
const departure = useNonNullContext(DepartureContext)
Expand All @@ -12,14 +12,21 @@ function Line() {
departure.serviceJourney.transportMode,
)

const publicCode = departure.serviceJourney.line.publicCode

return (
<td>
<TransportIcon
transportMode={departure.serviceJourney.transportMode}
publicCode={departure.serviceJourney.line.publicCode}
presentation={presentation}
/>
<div
className={classes.lineWrapper}
style={{
backgroundColor: presentation.backgroundColor,
color: presentation.color,
}}
>
{publicCode}
</div>
</td>
)
}

export { Line }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.lineWrapper {
text-align: center;
min-width: 3em;
max-width: fit-content;
padding: 0.25em;
border-radius: 0.2em;
font-size: 0.9em;
font-weight: 500;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import { TTransportMode } from 'types/graphql-schema'
import { TColors } from 'Board/utils/colors'
import { SVGProps } from 'react'
import classes from './styles.module.css'

function TransportIcon({
transportMode,
publicCode,
presentation,
}: {
transportMode: TTransportMode | null
publicCode: string | null
presentation: TColors
}) {
const mode = transportMode ? transportMode : 'unknown'

return (
<div
className={classes.transportIcon}
style={{
backgroundColor: presentation.backgroundColor,
fill: presentation.color,
color: presentation.color,
}}
>
{getTransportIcon(mode)} {publicCode}
{getTransportIcon(mode)}
</div>
)
}
Expand Down

This file was deleted.

0 comments on commit 935e3a6

Please sign in to comment.