Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
import NextLink from 'next/link'
|
||||
import { usePathname, useSearchParams } from 'next/navigation'
|
||||
import { useMemo } from 'react'
|
||||
"use client"
|
||||
import NextLink from "next/link"
|
||||
import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { useMemo } from "react"
|
||||
|
||||
import { linkVariants } from './variants'
|
||||
import { linkVariants } from "./variants"
|
||||
|
||||
import type { LinkProps } from './link'
|
||||
import { useIntl } from 'react-intl'
|
||||
import type { LinkProps } from "./link"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
export { LinkProps }
|
||||
|
||||
@@ -58,8 +58,8 @@ export default function Link({
|
||||
const newPath = href
|
||||
|
||||
if (keepSearchParams && searchParams.size) {
|
||||
if (newPath.includes('?')) {
|
||||
const newPathParts = newPath.split('?')
|
||||
if (newPath.includes("?")) {
|
||||
const newPathParts = newPath.split("?")
|
||||
const newSearchParams = new URLSearchParams(newPathParts[1])
|
||||
searchParams.forEach((v, k) => {
|
||||
if (!newSearchParams.has(k)) {
|
||||
@@ -81,12 +81,12 @@ export default function Link({
|
||||
href: fullUrl,
|
||||
className: classNames,
|
||||
title:
|
||||
props.target === '_blank'
|
||||
props.target === "_blank"
|
||||
? intl.formatMessage({
|
||||
id: 'common.linkOpenInNewTab',
|
||||
defaultMessage: 'Opens in a new tab/window',
|
||||
id: "common.linkOpenInNewTab",
|
||||
defaultMessage: "Opens in a new tab/window",
|
||||
})
|
||||
: '',
|
||||
: "",
|
||||
}
|
||||
|
||||
return isExternal ? (
|
||||
@@ -112,7 +112,7 @@ export default function Link({
|
||||
|
||||
const useCheckIfExternalLink = (url: string) => {
|
||||
return useMemo(() => {
|
||||
if (typeof window !== 'undefined' && url?.length) {
|
||||
if (typeof window !== "undefined" && url?.length) {
|
||||
try {
|
||||
const hostName = window.location.hostname
|
||||
const newURL = new URL(url)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
import type { linkVariants } from './variants'
|
||||
import type { linkVariants } from "./variants"
|
||||
|
||||
export interface LinkProps
|
||||
extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'color'>,
|
||||
extends
|
||||
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "color">,
|
||||
VariantProps<typeof linkVariants> {
|
||||
href: string
|
||||
scroll?: boolean
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from './link.module.css'
|
||||
import styles from "./link.module.css"
|
||||
|
||||
export const linkVariants = cva(styles.link, {
|
||||
variants: {
|
||||
@@ -8,18 +8,18 @@ export const linkVariants = cva(styles.link, {
|
||||
true: styles.active,
|
||||
},
|
||||
color: {
|
||||
none: '',
|
||||
none: "",
|
||||
peach50: styles.peach50,
|
||||
white: styles.white,
|
||||
red: styles.red,
|
||||
'Text/Interactive/Default': styles['Text-Interactive-Default'],
|
||||
'Text/Interactive/Secondary': styles['Text-Interactive-Secondary'],
|
||||
"Text/Interactive/Default": styles["Text-Interactive-Default"],
|
||||
"Text/Interactive/Secondary": styles["Text-Interactive-Secondary"],
|
||||
},
|
||||
size: {
|
||||
small: styles.small,
|
||||
large: styles.large,
|
||||
tiny: styles.tiny,
|
||||
none: '',
|
||||
none: "",
|
||||
},
|
||||
textDecoration: {
|
||||
underline: styles.underline,
|
||||
@@ -38,7 +38,7 @@ export const linkVariants = cva(styles.link, {
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
color: 'Text/Interactive/Default',
|
||||
size: 'large',
|
||||
color: "Text/Interactive/Default",
|
||||
size: "large",
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user