Compare commits

..
Author SHA1 Message Date
Ken 609678667f 🔥 Fjernet console.log 2022-11-16 09:46:42 +01:00
Ken 180ecd89bf 🎨 defaultMonth/Year prop 2022-11-15 12:15:09 +01:00
Ken 635b0859b8 defaultMonth/Year prop 2022-11-15 12:13:02 +01:00
Ken 10cbe105bc 🐛 Redirect funker nå med æøå 2022-11-12 21:20:11 +01:00
Ken f97eed8396 📝 Hide redirects from sanity search 2022-11-12 20:03:33 +01:00
Ken 119d9df7b5 📝 Sanity types 2022-11-12 19:45:02 +01:00
Ken 846d18cd23 🎨 Dynamic redirects 2022-11-12 19:40:14 +01:00
Ken 833c35cbbc 🐛 Headings i alert scrollet ikke ved linking 2022-11-11 12:43:35 +01:00
Ken 08353f50b5 💄 tema-lenker 2022-11-11 11:34:55 +01:00
Ken fba81fb4eb 🐛 Fikset tags komponentoversikt 2022-11-10 12:00:49 +01:00
Ken 9d9c6e9bfa 🐛 Fikset tags komponentoversikt 2022-11-10 11:07:34 +01:00
Ken 4dad81714f 🎨 Oppdatert tilbakemeldingsform for personvern 2022-11-09 13:19:34 +01:00
35 changed files with 268 additions and 119 deletions

No files matched your search

+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-codemod
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-codemod",
"version": "1.5.6",
"version": "1.5.8",
"description": "NAV designsystem codemods",
"author": "NAV Designsystem team",
"license": "MIT",
+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-css
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "1.5.6",
"version": "1.5.8",
"description": "Css for NAV Designsystem components",
"author": "NAV Designsystem team",
"keywords": [
@@ -20,7 +20,7 @@
"watch": "postcss --watch --use postcss-import -o dist/index.css index.css"
},
"devDependencies": {
"@navikt/ds-tokens": "^1.5.6",
"@navikt/ds-tokens": "^1.5.8",
"normalize.css": "^8.0.1",
"postcss": "^8.4.0",
"postcss-cli": "^9.0.0",
+18
View File
@@ -1,5 +1,23 @@
# @navikt/ds-react
## 1.5.8
### Patch Changes
- console.log removed
- Updated dependencies []:
- @navikt/ds-icons@1.5.8
## 1.5.7
### Patch Changes
- defaultMonth/Year prop date-komponent
- Updated dependencies []:
- @navikt/ds-icons@1.5.7
## 1.5.6
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "1.5.6",
"version": "1.5.8",
"description": "NAV designsystem react components",
"author": "NAV Designsystem team",
"license": "MIT",
@@ -37,7 +37,7 @@
},
"dependencies": {
"@floating-ui/react-dom-interactions": "0.9.2",
"@navikt/ds-icons": "^1.5.6",
"@navikt/ds-icons": "^1.5.8",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -286,3 +286,19 @@ export const UseRangedDatepickerValidation = () => {
</div>
);
};
export const defaultShownMonth = () => {
const { datepickerProps, inputProps } = UNSAFE_useDatepicker({
fromDate: new Date("Aug 23 2019"),
onDateChange: console.log,
defaultMonth: new Date("Oct 23 2022"),
});
return (
<div style={{ display: "flex", gap: "1rem" }}>
<DatePicker {...datepickerProps}>
<DatePicker.Input {...inputProps} label="Velg dato" />
</DatePicker>
</div>
);
};
@@ -28,6 +28,10 @@ export interface UseDatepickerOptions
* The initially selected Date
*/
defaultSelected?: Date;
/**
* Default shown month
*/
defaultMonth?: Date;
/**
* Make selection of Date required
*/
@@ -107,6 +111,7 @@ export const useDatepicker = (
onDateChange,
inputFormat,
onValidate,
defaultMonth,
} = opt;
const locale = getLocaleFromString(_locale);
@@ -117,7 +122,7 @@ export const useDatepicker = (
const [defaultSelected, setDefaultSelected] = useState(_defaultSelected);
// Initialize states
const [month, setMonth] = useState(defaultSelected ?? today);
const [month, setMonth] = useState(defaultSelected ?? defaultMonth ?? today);
const [selectedDay, setSelectedDay] = useState(defaultSelected);
const [open, setOpen] = useState(false);
@@ -168,14 +173,14 @@ export const useDatepicker = (
const reset = () => {
updateDate(defaultSelected);
setMonth(defaultSelected ?? today);
setMonth(defaultSelected ?? defaultMonth ?? today);
setInputValue(defaultInputValue ?? "");
setDefaultSelected(_defaultSelected);
};
const setSelected = (date: Date | undefined) => {
updateDate(date);
setMonth(date ?? today);
setMonth(date ?? defaultMonth ?? today);
setInputValue(
date ? formatDateForInput(date, locale, "date", inputFormat) : ""
);
@@ -257,7 +262,7 @@ export const useDatepicker = (
}
updateDate(day);
updateValidation();
setMonth(day);
setMonth(defaultMonth ?? day);
};
const handleClose = useCallback(() => {
@@ -31,6 +31,10 @@ export interface UseMonthPickerOptions
* validation-callback
*/
onValidate?: (val: MonthValidationT) => void;
/**
* Default shown year
*/
defaultYear?: Date;
}
interface UseMonthPickerValue {
@@ -89,6 +93,7 @@ export const useMonthpicker = (
onMonthChange,
inputFormat,
onValidate,
defaultYear,
} = opt;
const [defaultSelected, setDefaultSelected] = useState(_defaultSelected);
@@ -100,7 +105,7 @@ export const useMonthpicker = (
const monthpickerRef = useRef<HTMLDivElement>(null);
// Initialize states
const [year, setYear] = useState(defaultSelected ?? today);
const [year, setYear] = useState(defaultSelected ?? defaultYear ?? today);
const [selectedMonth, setSelectedMonth] = useState(defaultSelected);
const [open, setOpen] = useState(false);
@@ -151,14 +156,14 @@ export const useMonthpicker = (
const reset = () => {
updateMonth(defaultSelected);
setYear(defaultSelected ?? today);
setYear(defaultSelected ?? defaultYear ?? today);
setInputValue(defaultInputValue ?? "");
setDefaultSelected(_defaultSelected);
};
const setSelected = (date: Date | undefined) => {
updateMonth(date);
setYear(date ?? today);
setYear(date ?? defaultYear ?? today);
setInputValue(
date ? formatDateForInput(date, locale, "month", inputFormat) : ""
);
@@ -201,6 +201,7 @@ export const useRangeDatepicker = (
onRangeChange,
inputFormat,
onValidate,
defaultMonth,
} = opt;
const locale = getLocaleFromString(_locale);
@@ -213,7 +214,7 @@ export const useRangeDatepicker = (
// Initialize states
const [month, setMonth] = useState(
defaultSelected ? defaultSelected?.from : today
defaultSelected ? defaultSelected?.from : defaultMonth ?? today
);
const [selectedRange, setSelectedRange] = useState<DateRange | undefined>(
defaultSelected ?? { from: undefined, to: undefined }
@@ -284,7 +285,7 @@ export const useRangeDatepicker = (
const reset = () => {
updateRange(defaultSelected ?? { from: undefined, to: undefined });
setMonth(defaultSelected ? defaultSelected?.from : today);
setMonth(defaultSelected ? defaultSelected?.from : defaultMonth ?? today);
setValidation(
initialValidation(
defaultSelected ?? { from: undefined, to: undefined },
+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-tailwind
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "1.5.6",
"version": "1.5.8",
"description": "Auto-generated tailwind config based on @navikt/ds-tokens",
"author": "NAV Designsystem team",
"keywords": [
@@ -22,7 +22,7 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^1.5.6",
"@navikt/ds-tokens": "^1.5.8",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.35",
"jest": "^29.0.0",
+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-tokens
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "1.5.6",
"version": "1.5.8",
"description": "Auto-generated design-tokens for NAV design-systems framework",
"author": "NAV Designsystem team",
"keywords": [
+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-icons
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-icons",
"version": "1.5.6",
"version": "1.5.8",
"description": "Aksel icons",
"repository": {
"type": "git",
+4
View File
@@ -1,5 +1,9 @@
# @navikt/ds-css-internal
## 1.5.8
## 1.5.7
## 1.5.6
## 1.5.5
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css-internal",
"version": "1.5.6",
"version": "1.5.8",
"description": "Css for NAV internal Designsystem components",
"author": "NAV Designsystem team",
"keywords": [
+16
View File
@@ -1,5 +1,21 @@
# @navikt/ds-react-internal
## 1.5.8
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@1.5.8
- @navikt/ds-icons@1.5.8
## 1.5.7
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@1.5.7
- @navikt/ds-icons@1.5.7
## 1.5.6
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react-internal",
"version": "1.5.6",
"version": "1.5.8",
"description": "NAV internal designsystem react components",
"author": "NAV Designsystem team",
"license": "MIT",
@@ -35,8 +35,8 @@
"watch": "tsc --watch -p tsconfig.esm.json"
},
"dependencies": {
"@navikt/ds-icons": "^1.5.6",
"@navikt/ds-react": "^1.5.6",
"@navikt/ds-icons": "^1.5.8",
"@navikt/ds-react": "^1.5.8",
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.3.1"
},
+8 -8
View File
@@ -18,14 +18,14 @@
"website"
],
"dependencies": {
"@navikt/ds-codemod": "^1.5.6",
"@navikt/ds-css": "^1.5.6",
"@navikt/ds-css-internal": "^1.5.6",
"@navikt/ds-icons": "^1.5.6",
"@navikt/ds-react": "^1.5.6",
"@navikt/ds-react-internal": "^1.5.6",
"@navikt/ds-tailwind": "^1.5.6",
"@navikt/ds-tokens": "^1.5.6"
"@navikt/ds-codemod": "^1.5.8",
"@navikt/ds-css": "^1.5.8",
"@navikt/ds-css-internal": "^1.5.8",
"@navikt/ds-icons": "^1.5.8",
"@navikt/ds-react": "^1.5.8",
"@navikt/ds-react-internal": "^1.5.8",
"@navikt/ds-tailwind": "^1.5.8",
"@navikt/ds-tokens": "^1.5.8"
},
"devDependencies": {
"prettier-plugin-tailwindcss": "^0.1.13"
@@ -19,8 +19,6 @@ export default function SetAndPublishAction(props) {
}
}, [props.draft]);
console.log(markers);
return {
disabled:
publish.disabled ||
@@ -19,5 +19,6 @@ export const adminPanel = async (roles) =>
S.listItem()
.title("Standalone-sider")
.child(S.documentTypeList("aksel_standalone")),
S.listItem().title("Redirects").child(S.documentTypeList("redirect")),
])
);
@@ -0,0 +1,49 @@
const limits = [
"/blogg/",
"/artikkel/",
"/prinsipper/",
"/designsystem/side/",
"/designsystem/komponenter/",
];
export default {
name: "redirect",
title: "Redirect",
type: "document",
fields: [
{
name: "source",
title: "Fra",
type: "string",
validation: (Rule) =>
Rule.required().custom((_, { parent }) => {
if (!parent?.source?.startsWith?.("/")) {
return "Kan bare redirecte fra relativ-url, eks /min/gamle/sideurl";
}
const valid = limits.find(
(x) => parent?.source?.startsWith?.(x) && parent.source > x
);
if (!valid) {
return `Kan bare redirecte fra sider som starter med en av disse url-ene ${limits.join(
", "
)}`;
}
return true;
}),
},
{
name: "destination",
title: "Til",
type: "string",
validation: (Rule) => Rule.required(),
},
{
name: "permanent",
title: "Permanent",
type: "boolean",
initialValue: () => true,
},
],
__experimental_omnisearch_visibility: false,
};
+2
View File
@@ -6,6 +6,7 @@ import schemaTypes from "all:part:@sanity/base/schema-type";
import editors from "./documents/editors";
import navigation, { dropdown, link } from "./documents/navigation";
import frontpage from "./documents/frontpage";
import redirect from "./documents/redirects";
import * as Designsystem from "./documents/designsystem";
import * as Aksel from "./documents/aksel";
@@ -20,6 +21,7 @@ export default createSchema({
navigation,
link,
dropdown,
redirect,
Designsystem.Color,
Designsystem.ds_header_heading,
@@ -1,26 +1,16 @@
import {
BodyLong,
Button,
Heading,
Label,
Textarea,
TextField,
} from "@navikt/ds-react";
import cl from "classnames";
import { Button, Heading, Label, Textarea } from "@navikt/ds-react";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import isEmail from "validator/lib/isEmail";
import isEmpty from "validator/lib/isEmpty";
const FooterForm = () => {
const [contactForm, setContactForm] = useState({
content: "",
mail: "",
hasWritten: false,
});
const [contentError, setContentError] = useState({ content: "", mail: "" });
const [sent, setSent] = useState({ status: false, hadMail: false });
const [contentError, setContentError] = useState({ content: "" });
const [sent, setSent] = useState({ status: false });
const { asPath, basePath } = useRouter();
@@ -34,36 +24,26 @@ const FooterForm = () => {
});
fail = true;
}
if (
!isEmpty(contactForm.mail, { ignore_whitespace: true }) &&
!isEmail(contactForm.mail)
) {
setContentError({
...contentError,
mail: "Email ikke gyldig.",
});
fail = true;
}
if (fail) return;
setContentError({ content: "", mail: "" });
setContentError({ content: "" });
fetch("/api/generalFeedback", {
method: "POST",
body: JSON.stringify({
message: contactForm.content,
user: contactForm.mail,
url: `${basePath}${asPath}`,
}),
});
setSent({ status: true, hadMail: !!contactForm?.mail });
setContactForm({ content: "", mail: "", hasWritten: false });
setSent({ status: true });
setContactForm({ content: "", hasWritten: false });
};
useEffect(() => {
setSent({ status: false, hadMail: false });
setContactForm({ content: "", mail: "", hasWritten: false });
setContentError({ content: "", mail: "" });
setSent({ status: false });
setContactForm({ content: "", hasWritten: false });
setContentError({ content: "" });
}, [asPath]);
return (
@@ -72,13 +52,8 @@ const FooterForm = () => {
{sent.status ? (
<div>
<Label spacing as="p">
Melding er sendt til designsystemet
Meldingen er sendt til Aksel, takk for tilbakemeldingen!
</Label>
<BodyLong>
{`Takk skal du ha!${
sent.hadMail ? " Vi svarer deg så fort som mulig." : ""
}`}
</BodyLong>
</div>
) : (
<form onSubmit={(e) => handleSubmit(e)} className="w-full">
@@ -102,27 +77,9 @@ const FooterForm = () => {
!isEmpty(e.target.value, { ignore_whitespace: true }) &&
setContentError({ ...contentError, content: "" });
}}
description="Ikke skriv inn navn eller andre personopplysninger"
minRows={2}
/>
{contactForm.hasWritten && (
<TextField
className={cl("inverted-textfield")}
label="Vi svarer til e-post (valgfritt)"
error={contentError.mail}
value={contactForm.mail}
autoComplete="work email"
onChange={(e) => {
setContactForm({
...contactForm,
mail: e.target.value,
hasWritten: true,
});
e.target.value &&
isEmail(e.target.value) &&
setContentError({ ...contentError, mail: "" });
}}
/>
)}
</div>
{contactForm.hasWritten && (
<Button className="override-primary-button-dark">
@@ -35,7 +35,7 @@ const AkselArtikkelTemplate = ({
<FooterSlope />
<div className="relative bg-gray-100 pt-12 pb-16">
<div className="dynamic-wrapper">
<Heading level="2" size="medium" className="px-4 text-deepblue-700">
<Heading level="2" size="medium" className="text-deepblue-700 px-4">
{data?.relevante_artikler?.length === 1
? `Les også`
: `Relevante artikler`}
@@ -85,7 +85,7 @@ const AkselArtikkelTemplate = ({
<Heading
level="1"
size="large"
className="algolia-index-lvl1 mt-4 text-deepblue-700 md:text-5xl"
className="algolia-index-lvl1 text-deepblue-700 mt-4 md:text-5xl"
>
{data.heading}
</Heading>
@@ -98,7 +98,7 @@ const AkselArtikkelTemplate = ({
<BodyShort
size="small"
as="span"
className="whitespace-nowrap text-text-muted"
className="text-text-muted whitespace-nowrap"
>
{dateStr(data?._updatedAt)}
</BodyShort>
@@ -120,7 +120,7 @@ const AkselArtikkelTemplate = ({
<BodyShort
size="small"
as="a"
className="algolia-index-lvl5 flex min-h-8 items-center justify-center gap-[2px] rounded-full bg-gray-200 pl-4 pr-1 capitalize text-deepblue-800 no-underline hover:bg-gray-100 hover:underline focus:outline-none focus-visible:shadow-focus"
className="algolia-index-lvl5 min-h-8 text-deepblue-800 focus-visible:shadow-focus flex items-center justify-center gap-[2px] rounded-full bg-gray-200 pl-4 pr-1 capitalize no-underline hover:underline focus:outline-none"
>
{title}
<Next aria-hidden />
@@ -141,14 +141,14 @@ const AkselArtikkelTemplate = ({
<SanityBlockContent blocks={data?.content ?? []} variant="aksel" />
<div className="mt-12">
{authors?.length > 0 && (
<Label className="mb-2 text-deepblue-700" as="p">
<Label className="text-deepblue-700 mb-2" as="p">
Bidragsytere
</Label>
)}
{authors?.length > 0 && (
<BodyShort
as="div"
className="mb-1 flex flex-wrap gap-1 text-text/80"
className="text-text/80 mb-1 flex flex-wrap gap-1"
>
{authors.map(abbrName).map((x, y) => (
<address className="not-italic" key={x}>
@@ -158,7 +158,7 @@ const AkselArtikkelTemplate = ({
))}
</BodyShort>
)}
<BodyShort as="span" className="whitespace-nowrap text-text/80">
<BodyShort as="span" className="text-text/80 whitespace-nowrap">
Publisert: {dateStr(data?.publishedAt ?? data?._updatedAt)}
</BodyShort>
</div>
@@ -12,7 +12,13 @@ const Alert = ({
<div className="mb-7 max-w-2xl">
<DsAlert variant={node.variant}>
{node.heading && (
<Heading spacing size="small" as={node.heading_level} id={node._key}>
<Heading
spacing
size="small"
as={node.heading_level}
id={node._key}
className="scroll-m-20"
>
{node.heading}
</Heading>
)}
@@ -1,6 +1,6 @@
/* eslint-disable @next/next/no-img-element */
import { SanityT, urlFor } from "@/lib";
import { Heading } from "@navikt/ds-react";
import { Heading, Tag } from "@navikt/ds-react";
import Nextlink from "next/link";
import cl from "classnames";
@@ -8,25 +8,24 @@ const getStatus = (status?: SanityT.Schema.komponent_artikkel["status"]) => {
switch (status?.tag) {
case "beta":
return (
<span className="ml-2 rounded bg-purple-400 px-1 text-sm text-white">
<Tag variant="alt1" size="small">
Beta
</span>
</Tag>
);
case "new":
return (
<span className="ml-2 rounded bg-green-300 px-1 text-sm text-gray-900">
Ready
</span>
<Tag variant="info" size="small">
New
</Tag>
);
case "ready":
return null;
case "deprecated":
return (
<span className="ml-2 rounded bg-gray-200 px-1 text-sm text-gray-900">
<Tag variant="neutral" size="small">
Deprecated
</span>
</Tag>
);
default:
return null;
}
@@ -61,7 +60,7 @@ const ComponentOverview = ({
<ul className="component-card-grid">
{sorted.map((x) => (
<li key={x._id}>
<div className="group relative rounded shadow-small ring-1 ring-gray-900/10 focus-within:shadow-focus hover:shadow-medium">
<div className="shadow-small focus-within:shadow-focus hover:shadow-medium group relative rounded ring-1 ring-gray-900/10">
<div
className={cl(
"flex max-h-64 items-center justify-center overflow-hidden rounded-t bg-gray-50",
@@ -87,7 +86,7 @@ const ComponentOverview = ({
aria-hidden
xmlns="http://www.w3.org/2000/svg"
viewBox="-11.5 -10.23174 23 20.46348"
className="aspect-[1.25/1] h-auto max-h-64 min-h-40 p-4"
className="min-h-40 aspect-[1.25/1] h-auto max-h-64 p-4"
>
<title>React Logo</title>
<circle
@@ -152,7 +152,7 @@ export function TableOfContents({
</Heading>
<div
id="toc-scroll"
className="flex max-h-[80vh] flex-col overflow-y-scroll"
className="flex max-h-[80vh] flex-col overflow-y-auto"
>
<nav aria-labelledby="toc-heading">
<ul>
@@ -172,7 +172,7 @@ const Feedback = ({
<Button
variant="secondary"
className={cl({
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-2 ring-inset ring-deepblue-800 focus-visible:shadow-focus focus-visible:ring-1 focus-visible:ring-white":
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-deepblue-800 focus-visible:shadow-focus ring-2 ring-inset focus-visible:ring-1 focus-visible:ring-white":
activeState === HelpfulArticleEnum.JA,
})}
onClick={() =>
@@ -186,7 +186,7 @@ const Feedback = ({
<Button
variant="secondary"
className={cl({
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-2 ring-inset ring-deepblue-800 focus-visible:shadow-focus focus-visible:ring-1 focus-visible:ring-white":
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-deepblue-800 focus-visible:shadow-focus ring-2 ring-inset focus-visible:ring-1 focus-visible:ring-white":
activeState === HelpfulArticleEnum.NEI,
})}
onClick={() =>
@@ -200,7 +200,7 @@ const Feedback = ({
<Button
variant="secondary"
className={cl({
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-2 ring-inset ring-deepblue-800 focus-visible:shadow-focus focus-visible:ring-1 focus-visible:ring-white":
"override-secondary-button-active bg-deepblue-800 text-text-inverted ring-deepblue-800 focus-visible:shadow-focus ring-2 ring-inset focus-visible:ring-1 focus-visible:ring-white":
activeState === HelpfulArticleEnum.MISC,
})}
onClick={() =>
@@ -215,7 +215,7 @@ const Feedback = ({
{activeState !== null && (
<form
className={cl(
"mt-4 flex w-full max-w-sm animate-fadeIn flex-col gap-4",
"animate-fadeIn mt-4 flex w-full max-w-sm flex-col gap-4",
{
"override-primary-button": akselFeedback,
}
@@ -229,6 +229,7 @@ const Feedback = ({
onChange={(e) => setTextValue(e.target.value)}
maxLength={600}
minRows={3}
description="Ikke skriv inn navn eller andre personopplysninger"
/>
<Button className="mr-auto" onClick={handleSend}>
Send inn svar
+23
View File
@@ -117,6 +117,28 @@ Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider
>;
}
/**
* Redirect
*/
interface redirect extends Sanity.Document {
_type: "redirect";
/**
* Fra - `String`
*/
source?: string;
/**
* Til - `String`
*/
destination?: string;
/**
* Permanent - `Boolean`
*/
permanent?: boolean;
}
/**
* Fargekategori
*/
@@ -1546,6 +1568,7 @@ Husk å legge denne til i menyen også, hvis ikke blir den bare tilgjengelig via
| vk_frontpage
| editor
| navigation
| redirect
| ds_color_categories
| ds_tokens
| kode_eksempler_fil
+30
View File
@@ -0,0 +1,30 @@
import { getClient } from "@/sanity-client";
import { NextResponse } from "next/server";
export async function middleware(req) {
try {
const redirects = await getClient().fetch(`
*[_type == 'redirect'] {
destination,
source,
permanent
}
`);
const redirect = redirects.find(
(redirect) =>
decodeURIComponent(req.nextUrl.pathname) === redirect?.source
);
if (redirect) {
if (redirect.destination.startsWith("http")) {
return NextResponse.redirect(new URL(redirect.destination));
}
return NextResponse.redirect(new URL(redirect.destination, req.url));
}
return NextResponse.next();
} catch (e) {
return NextResponse.next();
}
}
@@ -19,9 +19,7 @@ export default async function handler(
return;
}
const card = `&name=${data.message}&desc=**Bruker:** %0A ${
data.user ? data.user : "Ukjent"
} %0A **Side:** %0A ${data.url}`;
const card = `&name=${data.message}&desc=**Bruker:** %0A **Side:** %0A ${data.url}`;
const url = `https://api.trello.com/1/cards?idList=619cc5721924df5816bcc45f&idLabels=${labels}&key=${trelloKey}&token=${trelloToken}${card}`;
const postRes = await fetch(url, {
+5 -5
View File
@@ -9,16 +9,16 @@
"lint": "next lint"
},
"dependencies": {
"@navikt/ds-css": "^1.5.6",
"@navikt/ds-icons": "^1.5.6",
"@navikt/ds-react": "^1.5.6",
"@navikt/ds-react-internal": "^1.5.6",
"@navikt/ds-css": "^1.5.8",
"@navikt/ds-icons": "^1.5.8",
"@navikt/ds-react": "^1.5.8",
"@navikt/ds-react-internal": "^1.5.8",
"next": "^12.2.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@navikt/ds-tailwind": "^1.5.6",
"@navikt/ds-tailwind": "^1.5.8",
"@types/node": "^17.0.35",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",