Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bruk designsystemets komponenter for tidslinjenavigering #2592

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},
"dependencies": {
"@axe-core/react": "^4.6.0",
"@navikt/ds-css": "2.0.12",
"@navikt/ds-css-internal": "2.0.12",
"@navikt/ds-icons": "2.0.12",
"@navikt/ds-react": "2.0.12",
"@navikt/ds-react-internal": "2.0.12",
"@navikt/ds-tokens": "2.0.12",
"@navikt/ds-css": "2.2.0",
"@navikt/ds-css-internal": "2.2.0",
"@navikt/ds-icons": "2.2.0",
"@navikt/ds-react": "2.2.0",
"@navikt/ds-react-internal": "2.2.0",
"@navikt/ds-tokens": "2.2.0",
"@navikt/familie-backend": "10.0.3",
"@navikt/familie-clipboard": "10.1.0",
"@navikt/familie-endringslogg": "8.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,27 @@ import React from 'react';

import styled from 'styled-components';

import { Back, Next } from '@navikt/ds-icons';
import { Button } from '@navikt/ds-react';

import { NavigeringsRetning } from '../../../context/TidslinjeContext';
import FamilieChevron from '../../../ikoner/FamilieChevron';

interface IProps {
naviger: (retning: NavigeringsRetning) => void;
kanNavigereTilHøyre?: boolean;
kanNavigereTilVenstre?: boolean;
navigerTilVenstreTittel?: string;
navigerTilHyøyreTittel?: string;
navigerTilHøyreTittel?: string;
children?: React.ReactNode | React.ReactChild | React.ReactChildren;
}

const StyledTidslinjenavigering = styled.div`
display: flex;
flex-direction: row;

& > button {
&:first-child {
margin-right: 0.625rem;
}
}
gap: 0.625rem;
`;

const DivMedHøyremargin = styled.div`
margin-right: 0.625rem;
const FlexMedSentrering = styled.div`
display: flex;
align-items: center;
`;
Expand All @@ -37,41 +31,29 @@ const TidslinjeNavigering: React.FC<IProps> = ({
naviger,
kanNavigereTilHøyre = true,
kanNavigereTilVenstre = true,
navigerTilVenstreTittel,
navigerTilHyøyreTittel,
navigerTilVenstreTittel = 'Naviger til venstre i tidslinjen',
navigerTilHøyreTittel = 'Naviger til høyre i tidslinjen',
children,
}) => {
return (
<StyledTidslinjenavigering className={'tidslinje-header__navigering'}>
<Button
title={'Naviger til venstre'}
title={navigerTilVenstreTittel}
variant="tertiary"
size="small"
disabled={!kanNavigereTilVenstre}
onClick={() => naviger(NavigeringsRetning.VENSTRE)}
>
<FamilieChevron title={'Naviger til venstre'} retning={'venstre'} />
<span className="sr-only">
{navigerTilVenstreTittel
? navigerTilVenstreTittel
: 'Naviger til venstre i tidslinjen'}
</span>
</Button>
{children && <DivMedHøyremargin>{children}</DivMedHøyremargin>}
icon={<Back title={navigerTilVenstreTittel} />}
/>
{children && <FlexMedSentrering>{children}</FlexMedSentrering>}
<Button
title={'Naviger til høyre'}
title={navigerTilHøyreTittel}
variant="tertiary"
size="small"
disabled={!kanNavigereTilHøyre}
onClick={() => naviger(NavigeringsRetning.HØYRE)}
>
<FamilieChevron title={'Naviger til høyre'} />
<span className="sr-only">
{navigerTilHyøyreTittel
? navigerTilHyøyreTittel
: 'Naviger til høyre i tidslinjen'}
</span>
</Button>
icon={<Next title={navigerTilHøyreTittel} />}
/>
</StyledTidslinjenavigering>
);
};
Expand Down
65 changes: 13 additions & 52 deletions src/frontend/komponenter/Fagsak/Behandlingsresultat/VinduVelger.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,25 @@
import React from 'react';

import styled from 'styled-components';

import navFarger from 'nav-frontend-core';

import { BodyShort } from '@navikt/ds-react';
import { ToggleGroup } from '@navikt/ds-react';

import { useTidslinje } from '../../../context/TidslinjeContext';
import FamilieBaseKnapp from '../../Felleskomponenter/FamilieBaseKnapp';

const VinduVelgerKnapp = styled(FamilieBaseKnapp)<{ valgt: boolean }>`
color: ${({ valgt }) => (valgt ? '#fff' : navFarger.navMorkGra)};
padding: 0.5rem;
border: 0.0625rem solid ${navFarger.navGra20};
background-color: ${({ valgt }) => (valgt ? navFarger.navGra80 : 'none')};

:first-child {
border-bottom-left-radius: 0.25rem;
border-top-left-radius: 0.25rem;
margin-right: -0.0625rem;
box-sizing: border-box;
}

:last-child {
border-bottom-right-radius: 0.25rem;
border-top-right-radius: 0.25rem;
margin-left: -0.0625rem;
}

:hover {
background-color: ${({ valgt }) => (valgt ? navFarger.navGra80 : navFarger.navLysGra)};
}

:focus {
background-color: ${({ valgt }) => (valgt ? navFarger.navGra80 : navFarger.navLysGra)};
outline: ${({ valgt }) =>
`0.1875rem solid ${valgt ? navFarger.navOransjeLighten20 : navFarger.fokusFarge}`};
outline-offset: -0.125rem;
position: relative;
}
`;
Comment on lines -12 to -42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 Sykt digg å bli kvitt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yessss enig!


const Vinduvelger: React.FunctionComponent = () => {
const { tidslinjeVinduer, endreTidslinjeVindu, aktivtTidslinjeVindu } = useTidslinje();

return (
<div>
{tidslinjeVinduer.map(vindu => {
return (
<VinduVelgerKnapp
key={vindu.id}
aria-label={vindu.label}
valgt={aktivtTidslinjeVindu.vindu.id === vindu.id}
onClick={() => endreTidslinjeVindu(vindu)}
>
<BodyShort size={'small'}>{vindu.label}</BodyShort>
</VinduVelgerKnapp>
);
})}
</div>
<ToggleGroup
defaultValue={aktivtTidslinjeVindu.vindu.id.toString()}
size="small"
variant="neutral"
onChange={vinduId => endreTidslinjeVindu(tidslinjeVinduer[Number(vinduId)])}
>
{tidslinjeVinduer.map(vindu => (
<ToggleGroup.Item key={vindu.id} value={vindu.id.toString()}>
{vindu.label}
</ToggleGroup.Item>
))}
</ToggleGroup>
);
};

Expand Down
2 changes: 2 additions & 0 deletions src/frontend/komponenter/Fagsak/Høyremeny/Høyremeny.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';

import { BackFilled, NextFilled } from '@navikt/ds-icons';
import { Button } from '@navikt/ds-react';
import { ASurfaceDefault } from '@navikt/ds-tokens/dist/tokens';
import { hentDataFraRessursMedFallback, RessursStatus } from '@navikt/familie-typer';

import { useBehandling } from '../../../context/behandlingContext/BehandlingContext';
Expand All @@ -24,6 +25,7 @@ const ToggleVisningHøyremeny = styled(Button)`
padding: 0px;
border-radius: 50%;
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25));
background-color: ${ASurfaceDefault};
`;

const Høyremeny: React.FunctionComponent = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/komponenter/Fagsak/Simulering/Årsvelger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Årsvelger: React.FC<Props> = ({
}
kanNavigereTilHøyre={!erISisteÅrAvPerioden}
kanNavigereTilVenstre={!(indexFramvistÅr === 0)}
navigerTilHyøyreTittel={`Vis simuleringsresultat for ${aktueltÅr + 1}`}
navigerTilHøyreTittel={`Vis simuleringsresultat for ${aktueltÅr + 1}`}
navigerTilVenstreTittel={`Vis simuleringsresultat for ${aktueltÅr - 1}`}
>
<Detail>{årISimuleringen[indexFramvistÅr]}</Detail>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styled from 'styled-components';

import { BackFilled, NextFilled } from '@navikt/ds-icons';
import { BodyShort, Button } from '@navikt/ds-react';
import { ASurfaceDefault } from '@navikt/ds-tokens/dist/tokens';
import { RessursStatus } from '@navikt/familie-typer';

import { useBehandling } from '../../../context/behandlingContext/BehandlingContext';
Expand All @@ -24,6 +25,7 @@ const ToggleVisningVenstremeny = styled(Button)`
padding: 0px;
border-radius: 50%;
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25));
background-color: ${ASurfaceDefault};
`;

const ÅpenMenyContainer = styled.div`
Expand Down
102 changes: 54 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2288,32 +2288,33 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@floating-ui/core@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.0.1.tgz#00e64d74e911602c8533957af0cce5af6b2e93c8"
integrity sha512-bO37brCPfteXQfFY0DyNDGB3+IMe4j150KFQcgJ5aBP295p9nBGeHEs/p0czrRbtlHq4Px/yoPXO/+dOCcF4uA==
"@floating-ui/core@^1.2.3":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.2.4.tgz#89e6311b021190c9e121fcf20306e76ac66e4066"
integrity sha512-SQOeVbMwb1di+mVWWJLpsUTToKfqVNioXys011beCAhyOIFtS+GQoW4EQSneuxzmQKddExDwQ+X0hLl4lJJaSQ==

"@floating-ui/dom@^1.0.0":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.0.2.tgz#c5184c52c6f50abd11052d71204f4be2d9245237"
integrity sha512-5X9WSvZ8/fjy3gDu8yx9HAA4KG1lazUN2P4/VnaXLxTO9Dz53HI1oYoh1OlhqFNlHgGDiwFX5WhFCc2ljbW3yA==
"@floating-ui/dom@^1.2.1":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.2.4.tgz#e2eb2674f57fc182c425587e48ea43e336f4b8f8"
integrity sha512-4+k+BLhtWj+peCU60gp0+rHeR8+Ohqx6kjJf/lHMnJ8JD5Qj6jytcq1+SZzRwD7rvHKRhR7TDiWWddrNrfwQLg==
dependencies:
"@floating-ui/core" "^1.0.1"
"@floating-ui/core" "^1.2.3"

"@floating-ui/react-dom-interactions@0.9.2":
version "0.9.2"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom-interactions/-/react-dom-interactions-0.9.2.tgz#9a364cc44ecbc242b5218dff0e0d071de115e13a"
integrity sha512-1I0urs4jlGuo4FRukvjtMmdUwxqvgwtTlESEPVwEvFGHXVh1PKkKaPZJ0Dcp9B8DQt4ewQEbwJxsoker2pDYTQ==
"@floating-ui/react-dom@^1.2.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-1.3.0.tgz#4d35d416eb19811c2b0e9271100a6aa18c1579b3"
integrity sha512-htwHm67Ji5E/pROEAr7f8IKFShuiCKHwUC/UY4vC3I5jiSvGFAYnSYiZO5MlGmads+QqvUkR9ANHEguGrDv72g==
dependencies:
"@floating-ui/react-dom" "^1.0.0"
aria-hidden "^1.1.3"
"@floating-ui/dom" "^1.2.1"

"@floating-ui/react-dom@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-1.0.0.tgz#e0975966694433f1f0abffeee5d8e6bb69b7d16e"
integrity sha512-uiOalFKPG937UCLm42RxjESTWUVpbbatvlphQAU6bsv+ence6IoVG8JOUZcy8eW81NkU+Idiwvx10WFLmR4MIg==
"@floating-ui/react@0.17.0":
version "0.17.0"
resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.17.0.tgz#f3a2fcb5c198df6cdc0aedac56bd3b2a6c0bb089"
integrity sha512-LYlTmiB1O2TmeNub1agGYJrO7Qkw1B0Q53aElN5dgZDO5v3yzYJmrGm/xmfD+0T03yEECzPKdwlSFCEPWKMLEQ==
dependencies:
"@floating-ui/dom" "^1.0.0"
"@floating-ui/react-dom" "^1.2.0"
aria-hidden "^1.1.3"
tabbable "^6.0.1"

"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
Expand Down Expand Up @@ -2667,49 +2668,49 @@
hey-listen "^1.0.8"
tslib "^2.3.1"

"@navikt/ds-css-internal@2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-css-internal/2.0.12/4c6153732513d8f3874b04afa3d1a3b2c58584fa#4c6153732513d8f3874b04afa3d1a3b2c58584fa"
integrity sha512-Ps+frViIdaXNvWfQhbZDBUoFgGQx/BOaqwr6t+tej7yqydZ7nfScU+XZPh9cnhaKrRxFtogKxn7Zko1mvQIrDA==
"@navikt/ds-css-internal@2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-css-internal/2.2.0/15ec6e265d2570d9bde61873592a453dd0cc968e#15ec6e265d2570d9bde61873592a453dd0cc968e"
integrity sha512-gHVMGP3NGHXNK//l3rWZHedcgfMKFNM/+NIMDOJ9H0z+ySTp8jcAiVuBTgYTzVmYRaHd6IJfgGLZF6xw2Ejr/A==

"@navikt/ds-css@2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-css/2.0.12/415923ba949853ce4946700f5bf16bbde68512d6#415923ba949853ce4946700f5bf16bbde68512d6"
integrity sha512-+XbDY6AMrWYifMr1dQ8QF5IIUhVj1Rhz8se0XS8wDiXMkNwsSPRenLipYplDY3qmUz7GBg4XEgFhGqHTIM7jkw==
"@navikt/ds-css@2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-css/2.2.0/d7625c3de971f9100542f4a19e7e4880252b378c#d7625c3de971f9100542f4a19e7e4880252b378c"
integrity sha512-b1CpbA11YhEzO/cwhTZUqlL2AuiSjNtmJ/beNN23ghDeWD+Shzz+cbYDEYLCFGU4o4wU4NejElxSCF9fBokTOQ==

"@navikt/ds-icons@2.0.12", "@navikt/ds-icons@^2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-icons/2.0.12/5a501c8994d587dfee3a6cddb6387ee1f05652f5#5a501c8994d587dfee3a6cddb6387ee1f05652f5"
integrity sha512-56ywftdtL5B4oZUb0ouO9rdN6X/refmDKJ+jtHt5jtnpjE+STpmCWmDCxacRSLb34YHmGJCl3zoyhPdelCZe9w==
"@navikt/ds-icons@2.2.0", "@navikt/ds-icons@^2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-icons/2.2.0/3bcfc2145b897a7c36c6ca4ce20ba3b991d64a90#3bcfc2145b897a7c36c6ca4ce20ba3b991d64a90"
integrity sha512-86vmaBIwdk8THOOYqHusiSKZ8e7imaog7EdHsJz+9CCt7uKE+as+c/aVCyz1LUJjjXhdt7ify4mq4MzPuHK9MQ==

"@navikt/ds-react-internal@2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-react-internal/2.0.12/5f8a245b17921338205bbcbbb100b60a27b5e67c#5f8a245b17921338205bbcbbb100b60a27b5e67c"
integrity sha512-csC2omUYr5LSmo/9W1G9m6pnGz7EZjaMY5B8dGUPRu3GlXLrQpTrBhPkdk3zmF0UnB4qMVxtXLEzIapqS/NA8w==
"@navikt/ds-react-internal@2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-react-internal/2.2.0/40474832be085a8359214d875cddc4cba677d56d#40474832be085a8359214d875cddc4cba677d56d"
integrity sha512-35XpwOGC+AouBKNvlyQJazd3B7IWasb8ZcAkZ7WMfkZKGXrzNArlYvYgTUIV0R1Jl9RoR5QrW2s3SNx1K4qQWQ==
dependencies:
"@navikt/ds-icons" "^2.0.12"
"@navikt/ds-react" "^2.0.12"
"@navikt/ds-icons" "^2.2.0"
"@navikt/ds-react" "^2.2.0"
clsx "^1.1.1"
copy-to-clipboard "^3.3.1"

"@navikt/ds-react@2.0.12", "@navikt/ds-react@^2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-react/2.0.12/8336c595bb47b32a004c28a0aa0c43485f9d5484#8336c595bb47b32a004c28a0aa0c43485f9d5484"
integrity sha512-i7rQQMDMPUtP+WDJTQ44rQ2xfE3mBzsD2LwgJ0+q4yV7HfMuCknM6DMs0hrwxWaO0i7qLAOv7bmDop+mTBXP1Q==
"@navikt/ds-react@2.2.0", "@navikt/ds-react@^2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-react/2.2.0/c20718a93e97f6d9e9346665ef301aa844e9ba24#c20718a93e97f6d9e9346665ef301aa844e9ba24"
integrity sha512-nWcr/ISwuKFtOD9GsBEdq/J+qKHuuPB4VZhvuxI1UCTEXYFxamBpb+ZaCi8/WLRPJ72cSyBUV9rUBESHzK8yBw==
dependencies:
"@floating-ui/react-dom-interactions" "0.9.2"
"@navikt/ds-icons" "^2.0.12"
"@floating-ui/react" "0.17.0"
"@navikt/ds-icons" "^2.2.0"
"@radix-ui/react-tabs" "1.0.0"
"@radix-ui/react-toggle-group" "1.0.0"
clsx "^1.2.1"
date-fns "2.29.3"
react-day-picker "8.3.4"
react-modal "3.15.1"

"@navikt/ds-tokens@2.0.12":
version "2.0.12"
resolved "https://npm.pkg.github.com/download/@navikt/ds-tokens/2.0.12/5b2d1cf1dcdd52250d47b8523b0b6db88796f973#5b2d1cf1dcdd52250d47b8523b0b6db88796f973"
integrity sha512-GQtxAvqcehQUfMZ9sf9xZf5BzInGIgnAYggtjSFLIfgznAbbKJ7XWMY7oDjmnNvb2/1tXh3pbdkmaMqpCVxXtg==
"@navikt/ds-tokens@2.2.0":
version "2.2.0"
resolved "https://npm.pkg.github.com/download/@navikt/ds-tokens/2.2.0/aa5998899fbb35f8d9a6b42e7f64a01a33064302#aa5998899fbb35f8d9a6b42e7f64a01a33064302"
integrity sha512-GCN90vyhxFxqwZiCBx0H/OMcz8tW4qdoEfsHIAaIyLuOzeW98aW75rP17ZJA+FtlmIkFvy6NShogQPpYppJAsA==

"@navikt/familie-backend@10.0.3":
version "10.0.3"
Expand Down Expand Up @@ -11317,6 +11318,11 @@ tabbable@^5.2.1:
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-5.2.1.tgz#e3fda7367ddbb172dcda9f871c0fdb36d1c4cd9c"
integrity sha512-40pEZ2mhjaZzK0BnI+QGNjJO8UYx9pP5v7BGe17SORTO0OEuuaAwQTkAp8whcZvqon44wKFOikD+Al11K3JICQ==

tabbable@^6.0.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-6.1.1.tgz#40cfead5ed11be49043f04436ef924c8890186a0"
integrity sha512-4kl5w+nCB44EVRdO0g/UGoOp3vlwgycUVtkk/7DPyeLZUCuNFFKCFG6/t/DgHLrUPHjrZg6s5tNm+56Q2B0xyg==

table@^6.0.9:
version "6.7.1"
resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
Expand Down