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

feat(theme): 🎨 apps/theme enabled in all linters #2101

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ packages/theme/brand/**/*
packages/react-old/**/*
tsc-build/
.storybook

apps/theme/**
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
'./tsconfig.json',
'./packages/*/tsconfig.json',
'./tsconfig.node.json',
'./apps/*/tsconfig.json'
],
},
rules: {
Expand Down
3 changes: 2 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/dist/**/*.css
packages/theme/brand/**/*.css
packages/css/dist/**/*.css
apps/theme/**

apps/theme/src/css/bootstrap-grid.css
6 changes: 3 additions & 3 deletions apps/theme/src/app/components/Color/Color.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
justify-content: center;
color: black;
font-weight: 400;
border: 1px solid rgb(228, 228, 228);
border: 1px solid rgb(228 228 228);
border-radius: 4px;
}

.box:hover {
cursor: pointer;
border-color: #ffffff;
border-color: #fff;
outline: 2px solid #535353;
outline-offset: 1px;
}
Expand All @@ -30,7 +30,7 @@
height: 15px;
width: 15px;
border-radius: 50%;
border: 1px solid rgb(160, 160, 160);
border: 1px solid rgb(160 160 160);
}

.contrast {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
width: 150px;
padding-left: 12px;
transition: 0.04s all;
border: 1px solid rgb(192, 192, 192);
border: 1px solid rgb(192 192 192);
background-color: transparent;
}

.container:hover {
border: 1px solid rgb(61, 61, 61);
outline: 1px solid rgb(61, 61, 61);
border: 1px solid rgb(61 61 61);
outline: 1px solid rgb(61 61 61);
}

.color {
height: 24px;
width: 24px;
background-color: #1e98f5;
border-radius: 50%;
border: 1px solid rgb(206, 206, 206);
border: 1px solid rgb(206 206 206);
}

.input {
Expand Down
4 changes: 2 additions & 2 deletions apps/theme/src/app/components/Group/Group.module.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.colors {
display: flex;
gap: 8px;
border-radius: 0px;
border-radius: 0;
}

.colorsFeatured {
/* padding: 0 14px; */
}

.header {
border-bottom: 1px solid #cccccc;
border-bottom: 1px solid #ccc;
margin-bottom: 16px;
padding-bottom: 16px;
text-align: center;
Expand Down
4 changes: 2 additions & 2 deletions apps/theme/src/app/components/Header/Header.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

.links a:hover {
border-color: rgb(212, 212, 212);
border-color: rgb(212 212 212);
}

.container {
Expand All @@ -29,7 +29,7 @@
}

.active {
border-color: rgb(185, 185, 185) !important;
border-color: rgb(185 185 185) !important;
font-weight: 500;
}

Expand Down
4 changes: 3 additions & 1 deletion apps/theme/src/app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Container } from 'react-bootstrap';
import Link from 'next/link';
import classes from './Header.module.css';
import { usePathname } from 'next/navigation';

import classes from './Header.module.css';


export const Header = () => {
const currentPath = usePathname();
return (
Expand All @@ -10,7 +12,7 @@
<Container className={classes.container}>
<div className={classes.logoContainer}>
<Link href='/'>
<img

Check warning on line 15 in apps/theme/src/app/components/Header/Header.tsx

View workflow job for this annotation

GitHub Actions / Builds, lints and tests code

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
src='img/logo.svg'
alt=''
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.box {
border: 1px solid rgb(235, 235, 235);
border: 1px solid rgb(235 235 235);

/* background-color: var(--fds-semantic-background-default); */
width: 100%;

padding: 32px;
border-radius: 8px;
display: flex;
gap: 32px;
box-shadow: 0px 0px 24px 4px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 24px 4px rgb(0 0 0 / 0.1);
}

.input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
width: 100%;
padding: 24px;
display: flex;

display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
grid-template-areas:
"checkbox checkbox checkbox user user user table table table table table table"
"help help help help help help radio radio radio tag tag tag"
"tabs tabs tabs tabs test test test faq faq faq faq faq"
"footerOne footerOne footerOne footerOne footerTwo footerTwo footerTwo footerTwo footerThree footerThree footerThree footerThree";
'checkbox checkbox checkbox user user user table table table table table table'
'help help help help help help radio radio radio tag tag tag'
'tabs tabs tabs tabs test test test faq faq faq faq faq'
'footerOne footerOne footerOne footerOne footerTwo footerTwo footerTwo footerTwo footerThree footerThree footerThree footerThree';
column-gap: 24px;
row-gap: 24px;
}
Expand Down Expand Up @@ -64,6 +63,17 @@
margin-top: -7px;
}

.tabs {
grid-area: tabs;
display: flex;
gap: 16px;
flex-direction: column;
}

.tabs button {
min-height: 40px;
}

.tableContainer {
grid-area: table;
}
Expand Down Expand Up @@ -94,7 +104,7 @@
height: 36px;
width: 36px;
border-radius: 50%;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
box-shadow: 0 0 4px rgb(0 0 0 / 0.25);
}

.tableAction {
Expand Down Expand Up @@ -139,28 +149,35 @@
.helpFirst {
border-color: var(--fds-semantic-border-first);
}

.helpFirstTitle {
color: var(--brandOne12);
}

.helpFirstDesc {
color: var(--brandOne12);
}

.helpSecond {
border-color: var(--fds-semantic-border-second);
}

.helpSecondTitle {
color: var(--brandTwo12);
}

.helpSecondDesc {
color: var(--brandTwo12);
}

.helpThird {
border-color: var(--fds-semantic-border-third);
}

.helpThirdTitle {
color: var(--brandThree12);
}

.helpThirdDesc {
color: var(--brandThree12);
}
Expand Down Expand Up @@ -203,17 +220,6 @@
margin-top: 16px;
}

.tabs {
grid-area: tabs;
display: flex;
gap: 16px;
flex-direction: column;
}

.tabs button {
min-height: 40px;
}

.faq {
grid-area: faq;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
row-gap: 24px;
column-gap: 24px;
grid-template-areas:
"colorcards colorcards colorcards colorcards colorcards colorcards colorcards colorcards users users users users"
"graph graph graph graph graph2 graph2 graph2 graph2 graph3 graph3 graph3 graph3";
'colorcards colorcards colorcards colorcards colorcards colorcards colorcards colorcards users users users users'
'graph graph graph graph graph2 graph2 graph2 graph2 graph3 graph3 graph3 graph3';
}

.users {
Expand All @@ -129,18 +129,20 @@

.userName {
font-size: 16px;
color: var(--grey13);
}

.user img {
width: 44px;
height: 44px;
border-radius: 50%;
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 1px 1px rgb(0 0 0 / 0.2);
}

.userTextContainer {
display: flex;
gap: 4px;
flex-direction: column;
}

.userRole {
Expand All @@ -159,15 +161,6 @@
color: var(--brandThree12);
}

.userName {
color: var(--grey13);
}

.userTextContainer {
display: flex;
flex-direction: column;
}

.graph {
grid-area: graph;
height: 400px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
.headerRight {
display: flex;
align-items: center;
gap: 0px;
gap: 0;
}

.headerMiddle {
Expand Down
5 changes: 2 additions & 3 deletions apps/theme/src/app/components/Scale/Scale.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useEffect, useState } from 'react';
import type { CssColor } from '@adobe/leonardo-contrast-colors';

import { generateColorScale } from '@/utils/themeUtils';
import type { modeType, ColorsType } from '@/types';

import type { modeType, ColorsType } from '../../../types';
import { generateColorScale } from '../../../utils/themeUtils';
import { Group } from '../Group/Group';

import classes from './Scale.module.css';
Expand Down
5 changes: 3 additions & 2 deletions apps/theme/src/app/components/ScaleRow/ScaleRow.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

.red {
color: rgb(212, 0, 0);
color: rgb(212 0 0);
}

.contrast {
Expand All @@ -37,7 +37,7 @@
align-items: center;
margin-top: 10px;
margin-bottom: 16px;
border: 1px solid rgb(206, 206, 206);
border: 1px solid rgb(206 206 206);
border-radius: 4px;
font-size: 16px;
position: relative;
Expand All @@ -56,6 +56,7 @@
height: 150px;
width: 170px;
margin-top: 2px;

/* padding: 20px; */
margin-right: 48px;
border-radius: 4px;
Expand Down
18 changes: 9 additions & 9 deletions apps/theme/src/app/components/ScaleRow/ScaleRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { CheckmarkIcon, XMarkIcon } from "@navikt/aksel-icons";
import { ChromePicker } from "react-color";
import { useClickOutside } from "@react-awesome/use-click-outside";

import type { modeType } from "@/types";
import { getRatioFromLum, luminanceFromHex } from "@/utils/ColorUtils";

import type { modeType } from "../../../types";
import { getRatioFromLum, luminanceFromHex } from "../../../utils/ColorUtils";
import { Scale } from "../Scale/Scale";

import classes from "./ScaleRow.module.css";
Expand All @@ -20,7 +19,7 @@ type ScaleRowProps = {
};

export const ScaleRow = ({
color,
color = "#00000",
showHeader,
name,
themeMode,
Expand All @@ -31,8 +30,8 @@ export const ScaleRow = ({
const ref = useRef(null);

useEffect(() => {
const lum1 = luminanceFromHex(color);
const lum2 = luminanceFromHex("#ffffff");
const lum1 = luminanceFromHex(color) as number;
const lum2 = luminanceFromHex("#ffffff") as number;
const ratio = getRatioFromLum(lum1, lum2);
setContrast(ratio);
setActiveColor(color);
Expand Down Expand Up @@ -67,13 +66,14 @@ export const ScaleRow = ({
>
<ChromePicker
onChange={(e) => {
const lum1 = luminanceFromHex(e.hex);
const lum2 = luminanceFromHex("#ffffff");
const lum1 = luminanceFromHex(e.hex as CssColor) as number;
const lum2 = luminanceFromHex("#ffffff") as number;
const ratio = getRatioFromLum(lum1, lum2);
setContrast(ratio);
setActiveColor(e.hex);
setActiveColor(e.hex as CssColor);
}}
color={activeColor}
/* @ts-expect-error Chromepicker has a width, but its not included in its types */
width={250}
/>
</div>
Expand Down
Loading
Loading