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

Convert to W3C DTCG format, #1481

Merged
merged 13 commits into from
Jan 22, 2025
Merged
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: 1 addition & 1 deletion docs/js/accordion.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/download-modal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/expand-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/filter-search-bar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/fitText.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/lang-switcher.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/lazyload.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/lightbox-gallery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/multi-select.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/navigation-data.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/navigation.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/our-expertise.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/parallax.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/resize.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/sdg-modal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/select.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/sidebar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/smartresize.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/smooth-bg-change.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/sticky.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/swiper.min.js

Large diffs are not rendered by default.

436 changes: 216 additions & 220 deletions figma-tokens/input/tokens.json

Large diffs are not rendered by default.

33,728 changes: 16,528 additions & 17,200 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@undp/design-system",
"version": "1.3.4",
"version": "1.3.9",
"description": "UNDP Design System",
"homepage": "https://design.undp.org",
"main": "index.js",
Expand Down
78 changes: 47 additions & 31 deletions stories/Components/UIcomponents/Cards/StatsCards/StatsCards.jsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,73 @@
import React, { useEffect } from 'react';
import { fitText } from '../../../../assets/js/fitText';
import './stats-cards.scss';
import { Heading } from '../../../../Atom/Typography/Heading/Heading';
import { P } from '../../../../Atom/BaseTypography/Paragraph/Paragraph';
import React, { useEffect } from "react";
import { fitText } from "../../../../assets/js/fitText";
import "./stats-cards.scss";
import { Heading } from "../../../../Atom/Typography/Heading/Heading";
import { P } from "../../../../Atom/BaseTypography/Paragraph/Paragraph";

const cls = (...classes) => {
if (typeof fitText == 'function') {
setTimeout(() => { fitText('.stats-card h2'); }, 200);
if (typeof fitText == "function") {
setTimeout(() => {
fitText(".stats-card h2");
}, 200);
}
return classes.filter(Boolean).length > 0 ? classes.filter(Boolean).join(' ') : null;
return classes.filter(Boolean).length > 0
? classes.filter(Boolean).join(" ")
: null;
};

export const accent_color_options = {
yellow: 'yellow',
red: 'red',
green: 'green',
blue: 'blue',
yellow: "yellow",
red: "red",
green: "green",
blue: "blue",
};

export function StatsCards({
title, number, percent, content, Size, ...args
}) {
export function StatsCards({ title, number, percent, content, Size, ...args }) {
let size;
switch (Size) {
case 'Small':
size = 'small';
case "Small":
size = "small";
break;
case 'Medium':
size = 'medium';
case "Medium":
size = "medium";
break;
case 'Large':
size = 'large';
case "Large":
size = "large";
break;
case 'Extra large':
size = 'x-large';
case "Extra large":
size = "x-large";
break;
default:
size = 'medium';
size = "medium";
}

useEffect(() => {
if (typeof fitText == 'function') {
fitText('.stats-card h2');
if (typeof fitText == "function") {
fitText(".stats-card h2");
}
}, []);
let color = (args.Hovercolor) ? accent_color_options[`${args.Hovercolor}`] : accent_color_options[`${args.accent}`];
let accent_color = color ? `accent-${color}` : '';
let color = args.Hovercolor
? accent_color_options[`${args.Hovercolor}`]
: accent_color_options[`${args.accent}`];
let accent_color = color ? `accent-${color}` : "";
let max_width = args.MaxWidth === "No" ? "full-width" : "";

return (
<div className={cls('stats-card', `${size}`, `${accent_color}`)}>
<div
className={cls(
"stats-card",
`${size}`,
`${accent_color}`,
`${max_width}`,
)}
>
<div>
{size == 'x-large' || size == 'large' ? (<Heading type="3" label={title} />) : null}
<div><Heading type="2" label={number} /></div>
{size == "x-large" || size == "large" ? (
<Heading type="3" label={title} />
) : null}
<div>
<Heading type="2" label={number} />
</div>
</div>
<div>
<Heading type="4" label={percent} />
Expand Down
Loading
Loading