Skip to content

Commit

Permalink
Merge pull request #524 from diggsweden/DIGG-450
Browse files Browse the repository at this point in the history
Digg 450
  • Loading branch information
MikaMunterud authored Dec 5, 2024
2 parents 601e732 + 13c2a1d commit 73f900b
Show file tree
Hide file tree
Showing 46 changed files with 1,211 additions and 1,065 deletions.
3 changes: 3 additions & 0 deletions assets/icons/check-done.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/chevron-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions assets/icons/chevronDown.svg

This file was deleted.

3 changes: 0 additions & 3 deletions assets/icons/chevronUp.svg

This file was deleted.

2 changes: 1 addition & 1 deletion assets/icons/closeCross.svg → assets/icons/cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions components/blocks/accordion-block/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import useTranslation from "next-translate/useTranslation";
import { FC, useContext, useState } from "react";

import CloseIcon from "@/assets/icons/closeCross.svg";
import CrossIcon from "@/assets/icons/cross.svg";
import PlusIcon from "@/assets/icons/plus.svg";
import { HtmlParser } from "@/components/typography/html-parser";
import { FaqFragment as IFaq } from "@/graphql/__generated__/operations";
Expand Down Expand Up @@ -38,7 +38,7 @@ export const AccordionBlock: FC<AccordionBlockProps> = ({
{question}
</span>
{open ? (
<CloseIcon
<CrossIcon
width={iconSize * 1.5}
height={iconSize * 1.5}
viewBox="0 0 24 24"
Expand Down
47 changes: 41 additions & 6 deletions components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const buttonVariants = cva(["button"], {
variant: {
primary: ["button--primary"],
secondary: ["button--secondary"],
light: ["button--light"],
plain: ["button--plain"],
pink: ["button--pink"],
filter: ["button--filter"],
Expand All @@ -37,26 +38,57 @@ type IconLabelProps = {
size?: "xs" | "sm" | "lg";
label?: string;
iconPosition?: "left" | "right";
iconSizeBase?: number;
};

const IconLabel: FC<IconLabelProps> = ({ icon, label, size, iconPosition }) => {
const IconLabel: FC<IconLabelProps> = ({
icon,
label,
size,
iconPosition,
iconSizeBase,
}) => {
const Icon = icon;
const { iconSize } = useContext(SettingsContext);
const { iconSize: contextIconSize } = useContext(SettingsContext);

return (
<>
{iconPosition === "left" && Icon && (
<Icon
height={size === "lg" ? 1.5 * iconSize : iconSize}
width={size === "lg" ? 1.5 * iconSize : iconSize}
height={
iconSizeBase
? iconSizeBase
: size === "lg"
? 1.5 * contextIconSize
: contextIconSize
}
width={
iconSizeBase
? iconSizeBase
: size === "lg"
? 1.5 * contextIconSize
: contextIconSize
}
viewBox="0 0 24 24"
/>
)}
{label && <span>{label}</span>}
{iconPosition === "right" && Icon && (
<Icon
height={size === "lg" ? 1.5 * iconSize : iconSize}
width={size === "lg" ? 1.5 * iconSize : iconSize}
height={
iconSizeBase
? iconSizeBase
: size === "lg"
? 1.5 * contextIconSize
: contextIconSize
}
width={
iconSizeBase
? iconSizeBase
: size === "lg"
? 1.5 * contextIconSize
: contextIconSize
}
viewBox="0 0 24 24"
/>
)}
Expand All @@ -67,6 +99,7 @@ const IconLabel: FC<IconLabelProps> = ({ icon, label, size, iconPosition }) => {
type ButtonProps = VariantProps<typeof buttonVariants> & {
icon?: AddIcon;
iconPosition?: "left" | "right";
iconSize?: number;
label?: string;
};

Expand All @@ -78,6 +111,7 @@ const Button: FC<
className,
icon,
iconPosition,
iconSize,
label,
children,
...rest
Expand All @@ -90,6 +124,7 @@ const Button: FC<
>
<IconLabel
size={size ? size : "lg"}
iconSizeBase={iconSize}
iconPosition={iconPosition}
icon={icon}
label={label}
Expand Down
4 changes: 2 additions & 2 deletions components/form/render-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Translate } from "next-translate";
import useTranslation from "next-translate/useTranslation";
import { ChangeEvent, DragEvent, FC, useCallback, useState } from "react";

import ChevronDownIcon from "@/assets/icons/chevronDown.svg";
import ChevronUpIcon from "@/assets/icons/chevronUp.svg";
import ChevronDownIcon from "@/assets/icons/chevron-down.svg";
import ChevronUpIcon from "@/assets/icons/chevron-up.svg";
import { Button } from "@/components/button";
import { Label } from "@/components/form/label";
import { RadioInput } from "@/components/form/radio-input";
Expand Down
2 changes: 1 addition & 1 deletion components/form/select/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, InputHTMLAttributes, PropsWithChildren, useContext } from "react";

import ChevronDownIcon from "@/assets/icons/chevronDown.svg";
import ChevronDownIcon from "@/assets/icons/chevron-down.svg";
import { SettingsContext } from "@/providers/settings-provider";

interface SelectProps extends InputHTMLAttributes<HTMLSelectElement> {
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/container-nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { usePathname } from "next/navigation";
import useTranslation from "next-translate/useTranslation";
import { FC, KeyboardEvent, useEffect, useRef, useState } from "react";

import CloseCrossIcon from "@/assets/icons/closeCross.svg";
import CrossIcon from "@/assets/icons/cross.svg";
import HamburgerIcon from "@/assets/icons/hamburger.svg";
import { Button } from "@/components/button";
import { ContainerDataFragment } from "@/graphql/__generated__/operations";
Expand Down Expand Up @@ -86,7 +86,7 @@ export const ContainerNav: FC<ContainerDpDwnProps> = ({ related }) => {
{vw < 1124 && (
<Button
iconPosition="left"
icon={expanded ? CloseCrossIcon : HamburgerIcon}
icon={expanded ? CrossIcon : HamburgerIcon}
label={related[0].name}
onClick={handleToggle}
className={`!button--large relative z-40 w-full md:w-[20rem] xl:hidden`}
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/form-nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
useState,
} from "react";

import ChevronDownIcon from "@/assets/icons/chevronDown.svg";
import ChevronUpIcon from "@/assets/icons/chevronUp.svg";
import ChevronDownIcon from "@/assets/icons/chevron-down.svg";
import ChevronUpIcon from "@/assets/icons/chevron-up.svg";
import { Button } from "@/components/button";
import { useClickOutside } from "@/hooks/use-click-outside";
import { handleScroll } from "@/utilities/form-utils";
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/main-nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { usePathname } from "next/navigation";
import useTranslation from "next-translate/useTranslation";
import { FC, useEffect, useRef, useState, useContext } from "react";

import CloseCrossIcon from "@/assets/icons/closeCross.svg";
import CrossIcon from "@/assets/icons/cross.svg";
import HamburgerIcon from "@/assets/icons/hamburger.svg";
import SearchIcon from "@/assets/icons/search.svg";
import DataportalTestLogo from "@/assets/logos/dataportalTest.svg";
Expand Down Expand Up @@ -137,7 +137,7 @@ const MainNav: FC<MainNavProps> = ({ setOpenSideBar, openSideBar }) => {
aria-expanded={openSideBar}
aria-controls="sidebar"
variant="plain"
icon={openSideBar ? CloseCrossIcon : HamburgerIcon}
icon={openSideBar ? CrossIcon : HamburgerIcon}
iconPosition="left"
onClick={() => setOpenSideBar(!openSideBar)}
label={t("common|menu")}
Expand Down
Loading

0 comments on commit 73f900b

Please sign in to comment.