Skip to content

Commit

Permalink
Ryddet TeamName, mer lestbart
Browse files Browse the repository at this point in the history
  • Loading branch information
beeccy committed Dec 12, 2023
1 parent e7cd003 commit 5378189
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions apps/frontend/src/components/common/TeamName.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
import { BodyShort, Link } from '@navikt/ds-react'
import { useTeam } from '../../api/TeamApi'
import { teamKatTeamLink } from '../../util/config'
import { BodyShort, Detail, Link } from '@navikt/ds-react'

export const TeamName = (props: { id: string; link?: boolean; big?: boolean }) => {
const [name] = useTeam()(props.id)
interface IPropsTeamName {
id: string
link?: boolean
big?: boolean
}

interface IPropsTeams {
teams: string[]
link?: boolean
list?: boolean
big?: boolean
}

export const TeamName = (props: IPropsTeamName) => {
const { id, link, big } = props
const [name] = useTeam()(id)

return props.link ? (
<Link className={props.big ? '' : 'text-medium'} rel="noopener noreferrer" target={'_blank'} href={teamKatTeamLink(props.id)}>
return link ? (
<Link className={big ? '' : 'text-medium'} rel="noopener noreferrer" target={'_blank'} href={teamKatTeamLink(id)}>
{name} (åpnes i ny fane)
</Link>
) : (
<>{name}</>
)
}

export const Teams = (props: { teams: string[]; link?: boolean; list?: boolean; big?: boolean }) => (
<div className="flex flex-wrap gap-2 items-center">
<BodyShort size="small">Team:</BodyShort>
{props.teams.map((t, idx) => (
<TeamName key={`team_${idx}`} id={t} link={props.link} big={props.big} />
))}
</div>
)
export const Teams = (props: IPropsTeams) => {
const { teams, link, big } = props

return (
<div className="flex flex-wrap gap-2 items-center">
<BodyShort size="small">Team:</BodyShort>
{teams.map((team, index) => (
<TeamName key={`team_${index}`} id={team} link={link} big={big} />
))}
</div>
)
}

0 comments on commit 5378189

Please sign in to comment.