Skip to content

Commit 4e96cdc

Browse files
committed
fix: custom calculation extraction to be full classes instead of string interpolation
1 parent 573a1a2 commit 4e96cdc

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

web/src/components/RegistryCard/RegistryInfo.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ interface IListInfo {
1818
isListView?: boolean;
1919
}
2020

21-
const firstColWidthCalc = "calc(80px+(100-80)*(min(max(100vw,900px),1250px)-900px)/(1250-900))";
22-
const secondColWidthCalc = "calc(100px+(150-100)*(min(max(100vw,900px),1250px)-900px)/(1250-900))";
21+
const landscapeGridColsCalc =
22+
"lg:grid-cols-[auto_1fr_calc(80px+(100-80)*(min(max(100vw,900px),1250px)-900px)/(1250-900))_calc(100px+(150-100)*(min(max(100vw,900px),1250px)-900px)/(1250-900))_max-content]";
2323

2424
const ListInfo: React.FC<IListInfo> = ({ title, totalItems, logoURI, status, isListView = false }) => {
2525
const [imageLoaded, setImageLoaded] = useState(false);
@@ -39,8 +39,8 @@ const ListInfo: React.FC<IListInfo> = ({ title, totalItems, logoURI, status, isL
3939
"w-full h-max lg:h-16 p-4",
4040
"[&_h3]:col-span-4 [&_img]:col-span-4",
4141
"lg:justify-between lg:grid-rows-[1fr] lg:px-8",
42-
`lg:grid-cols-[auto_1fr_${firstColWidthCalc}_${secondColWidthCalc}_max-content]`,
4342
"lg:[&_img]:col-span-1 lg:[&_h3]:col-span-2",
43+
landscapeGridColsCalc,
4444
]
4545
)}
4646
style={{ columnGap: isListView ? responsiveSize(8, 24, 900) : undefined }}

web/src/components/StatDisplay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ interface IStatDisplay {
1111
color: IColors;
1212
}
1313

14-
const marginBottomCalc = "calc(16px+(30-16)*(min(max(100vw,375px),1250px)-375px)/(1250-375))";
14+
const landscapeMarginBottomCalc = "lg:mb-[calc(16px+(30-16)*(min(max(100vw,375px),1250px)-375px)/(1250-375))]";
1515

1616
const StatDisplay: React.FC<IStatDisplay> = ({ title, text, subtext, icon: Icon, color, ...props }) => {
1717
return (
18-
<div className={clsx("flex items-center gap-2 max-w-[192px]", `lg:mb-[${marginBottomCalc}]`)} {...props}>
18+
<div className={clsx("flex items-center gap-2 max-w-[192px]", landscapeMarginBottomCalc)} {...props}>
1919
<div
2020
className={cn(
2121
"flex items-center justify-center h-12 w-12 rounded-[50%]",

web/src/layout/Header/navbar/DappList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ interface IDappList {
8282
toggleIsDappListOpen: () => void;
8383
}
8484

85-
const widthCalc = "calc(300px+(480-300)*(min(max(100vw,375px),1250px)-375px)/(1250-375))";
85+
const landscapeWidthCalc = "lg:w-[calc(300px+(480-300)*(min(max(100vw,375px),1250px)-375px)/(1250-375))]";
8686

8787
const DappList: React.FC<IDappList> = ({ toggleIsDappListOpen }) => {
8888
const containerRef = useRef(null);
@@ -97,7 +97,7 @@ const DappList: React.FC<IDappList> = ({ toggleIsDappListOpen }) => {
9797
"bg-klerosUIComponentsWhiteBackground shadow-[0px_2px_3px_rgba(0,0,0,0.06)]",
9898
"[&_svg]:visible",
9999
"lg:mt-16 lg:top-0 lg:left-0 lg:right-auto lg:transform-none lg:translate-x-0 lg:max-h-[80vh]",
100-
`lg:w-[${widthCalc}]`
100+
landscapeWidthCalc
101101
)}
102102
>
103103
<h1 className="pt-6 text-2xl font-semibold leading-8">Kleros Solutions</h1>

web/src/layout/Header/navbar/Menu/Settings/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const TABS = [
2222
},
2323
];
2424

25-
const inlinePaddingCalc = "calc(8px+(32-8)*((100vw-300px)/(1250-300)))";
26-
const widthCalc = "calc(300px+(424-300)*((100vw-300px)/(1250-300)))";
25+
const inlinePaddingCalc = "px-[calc(8px+(32-8)*((100vw-300px)/(1250-300)))]";
26+
const landscapeWidthCalc = "lg:w-[calc(300px+(424-300)*((100vw-300px)/(1250-300)))]";
2727

2828
const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
2929
const [currentTab, setCurrentTab] = useState<number>(0);
@@ -46,7 +46,7 @@ const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
4646
>
4747
<div className="flex justify-center text-2xl mt-6 text-klerosUIComponentsPrimaryText">Settings</div>
4848
<Tabs
49-
className={clsx(`py-0 px-[${inlinePaddingCalc}]`, `max-w-[660px] w-[86vw] lg:w-[${widthCalc}]`)}
49+
className={clsx(`py-0 ${inlinePaddingCalc}`, `max-w-[660px] w-[86vw] ${landscapeWidthCalc}`)}
5050
items={TABS}
5151
callback={(_, value: number) => {
5252
setCurrentTab(value);

web/src/pages/Home/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import Header from "./Header";
66
import Stats from "./Stats";
77
import HighlightedLists from "./Highlights";
88

9-
const inlinePaddingCalc = "calc(0px+(132-0)*(min(max(100vw,375px),1250px)-375px)/(1250-375))";
9+
const landscapeInlinePaddingCalc = "lg:px-[calc(0px+(132-0)*(min(max(100vw,375px),1250px)-375px)/(1250-375))]";
1010

1111
const Home: React.FC = () => {
1212
return (
1313
<>
1414
<HeroImage />
1515
<div
1616
className={clsx(
17-
"w-full max-w-[1400px] mx-auto bg-klerosUIComponentsLightBackground px-4 pt-4 pb-10",
18-
`lg:px-[${inlinePaddingCalc}] lg:pb-[60px]`
17+
"w-full max-w-landscape mx-auto bg-klerosUIComponentsLightBackground px-4 pt-4 pb-10",
18+
`${landscapeInlinePaddingCalc} lg:pb-[60px]`
1919
)}
2020
>
2121
<Header />

0 commit comments

Comments
 (0)