Skip to content

Commit fa79e20

Browse files
authored
chore(release): 1.1.0 (#6)
- Set Monserrat as a font globally - harmonize button style and comportement - update snackbar variant - fix checkboxes and label alignment - add customizable labels to Header and UserMenu components - fix responsive logo shadows bug
1 parent 28ef053 commit fa79e20

21 files changed

Lines changed: 1455 additions & 576 deletions

package-lock.json

Lines changed: 1185 additions & 463 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@orif-informatique/react-components-library",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"private": false,
55
"type": "module",
66
"main": "dist/index.cjs.js",
@@ -18,7 +18,8 @@
1818
"files": [
1919
"dist",
2020
"package.json",
21-
"README.md"
21+
"README.md",
22+
"assets"
2223
],
2324
"scripts": {
2425
"clean": "rimraf dist src/styles/dist || true",
@@ -50,6 +51,7 @@
5051
"@tailwindcss/postcss": "^4.1.13",
5152
"@vitejs/plugin-react": "^4.7.0",
5253
"autoprefixer": "^10",
54+
"cssnano": "^7.1.2",
5355
"esbuild": "^0.25.9",
5456
"postcss": "^8.5.6",
5557
"postcss-url": "^10",

rollup.config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import esbuild from 'rollup-plugin-esbuild';
55
import postcss from 'rollup-plugin-postcss';
66
import tailwind from '@tailwindcss/postcss';
77
import autoprefixer from 'autoprefixer';
8+
import cssnano from 'cssnano';
89
import del from 'rollup-plugin-delete';
910
import { promises as fs } from 'node:fs';
1011
import { join } from 'node:path';
@@ -82,9 +83,17 @@ export default {
8283

8384
// CSS Tailwind v4
8485
postcss({
85-
plugins: [tailwind(), autoprefixer()],
86+
plugins: [
87+
tailwind(),
88+
autoprefixer(),
89+
cssnano({
90+
preset: ['default', {
91+
mergeRules: false, //merge disabled to avoid bug with Tailwind CSS when using responsive property
92+
}],
93+
}),
94+
],
8695
extract: 'styles.css',
87-
minimize: true,
96+
minimize: false,
8897
}),
8998

9099
// Inliner post-build des icônes référencées par le CSS

src/index.css

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,48 @@
11
@import "tailwindcss";
22
@plugin "@tailwindcss/forms";
33

4+
/* Import police Montserrat*/
5+
@font-face {
6+
font-family: "Montserrat";
7+
src: url("../assets/fonts/montserrat.ttf") format("truetype");
8+
font-weight: 100 900;
9+
}
10+
411
/* Thème du projet (noms strictement identiques) */
512
@theme {
6-
--color-primary: #005ba9;
13+
--color-primary: #005ba9;
714
--color-background: #f4f7fd;
8-
--color-disabled: #e7e7e7;
9-
--color-danger: #b91c1c;
15+
--color-disabled: #e7e7e7;
16+
--color-danger: #b91c1c;
1017

1118
--font-display: "Montserrat", sans-serif;
19+
20+
--animate-fade-in: fade-in 0.3s ease-out;
21+
@keyframes fade-in {
22+
0% {
23+
opacity: 0;
24+
}
25+
26+
100% {
27+
opacity: 1;
28+
}
29+
}
30+
31+
--animate-fade-out: fade-out 0.3s ease-in forwards;
32+
@keyframes fade-out {
33+
0% {
34+
opacity: 1;
35+
}
36+
37+
100% {
38+
opacity: 0;
39+
}
40+
}
1241
}
1342

43+
/* Applique la police Montserrat globalement */
44+
@layer base {
45+
* {
46+
font-family: "Montserrat", sans-serif;
47+
}
48+
}

src/ui/buttons/default/Button.jsx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ const Button = ({
1616
const buttonMode = (variant) => {
1717
switch (variant) {
1818
case "primary":
19-
return "bg-primary text-white active:bg-opacity-80";
19+
return "bg-primary text-white before:border-transparent";
2020
case "secondary":
21-
return "border border-primary text-primary hover:bg-primary hover:text-white active:bg-opacity-80 active:border-opacity-0";
21+
return "bg-white text-primary";
2222
case "tertiary":
23-
return "border border-black border-opacity-60 hover:bg-gray-800 hover:text-white active:bg-gray-600 active:border-opacity-0";
23+
return "bg-white text-black";
2424
case "link":
2525
return "text-primary font-light hover:underline focus:underline";
2626
case "danger":
27-
return "border border-danger text-danger hover:bg-danger hover:text-white active:bg-opacity-80 active:border-opacity-0";
27+
return "bg-white text-danger before:border-danger";
2828
default:
2929
return "border border-black border-opacity-60 active:text-gray-700";
3030
}
@@ -35,11 +35,11 @@ const Button = ({
3535
case "small":
3636
return "text-sm";
3737
case "medium":
38-
return "text-md";
38+
return "text-base";
3939
case "large":
4040
return "text-lg";
4141
default:
42-
return "text-md";
42+
return "text-base";
4343
}
4444
};
4545

@@ -74,9 +74,27 @@ const Button = ({
7474
return (
7575
<button
7676
className={[
77-
"group flex justify-center items-center font-semibold",
77+
"group flex justify-center items-center font-medium",
7878
variant !== "link"
79-
? "rounded-sm transition transform duration-300 px-4 py-2 gap-2 hover:scale-105"
79+
? `rounded-sm transition transform duration-300 px-4 py-2 gap-2
80+
relative isolate
81+
before:content-['']
82+
before:absolute
83+
before:inset-0
84+
before:-z-10
85+
before:border
86+
before:rounded
87+
before:bg-inherit
88+
before:transition-all before:duration-300
89+
hover:before:scale-105
90+
active:before:scale-[1.01]
91+
hover:shadow-lg/22
92+
active:shadow-lg/14
93+
disabled:opacity-50
94+
disabled:cursor-not-allowed
95+
disabled:hover:before:scale-100
96+
disabled:hover:shadow-none
97+
focus:outline-offset-2`
8098
: "",
8199
className,
82100
buttonMode(variant),
@@ -86,7 +104,7 @@ const Button = ({
86104
{...props}
87105
>
88106
{icon && (
89-
<Icon name={icon} color={iconColor(variant)} size={iconSize(size)} />
107+
<Icon name={icon} color={iconColor(variant)} size={iconSize(size)} disableAnimation={true} />
90108
)}
91109
{label && (
92110
<span className={hideTextOnMobile && icon ? "hidden sm:inline" : ""}>

src/ui/buttons/default/Button.stories.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export const Tertiary = {
3737
export const Danger = {
3838
args: {
3939
variant: "danger",
40-
icon: "cross"
40+
icon: "cross",
41+
size: "medium"
4142
}
4243
}
4344

src/ui/buttons/scroll-to-top/ScrollToTopButton.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ import { useState, useEffect } from "react";
22

33
const ScrollToTopButton = () => {
44
const [isVisible, setVisible] = useState(false);
5+
const [isClosing, setIsClosing] = useState(false);
56

67
useEffect(() => {
78
const toggleVisibility = () => {
89
if (window.scrollY > 200) {
910
setVisible(true);
10-
} else {
11-
setVisible(false);
11+
setIsClosing(false);
12+
} else if (isVisible) {
13+
setIsClosing(true);
14+
setTimeout(() => {
15+
setVisible(false);
16+
setIsClosing(false);
17+
}, 300);
1218
}
1319
}
1420

1521
window.addEventListener("scroll", toggleVisibility);
1622
return () => window.removeEventListener("scroll", toggleVisibility);
17-
}, []);
23+
}, [isVisible]);
1824

1925
const scrollToTop = () => {
2026
window.scrollTo({
@@ -28,7 +34,7 @@ const ScrollToTopButton = () => {
2834
return (
2935
<button
3036
onClick={scrollToTop}
31-
className="fixed bottom-16 right-8 p-3 bg-primary bg-opacity-80 rounded-full transition duration-300 hover:bg-opacity-100 hover:scale-105"
37+
className={`fixed bottom-16 right-8 p-3 bg-primary bg-opacity-80 rounded-full transition duration-300 hover:bg-opacity-100 hover:scale-105 ${isClosing ? 'animate-fade-out' : 'animate-fade-in'}`}
3238
>
3339
<svg className="size-6 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor">
3440
<path strokeLinecap="round" strokeLinejoin="round" d="M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18" />

src/ui/header/Header.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import UserMenu from "../user-menu/UserMenu";
99
const Header = ({
1010
user = null,
1111
title = null,
12+
greetingLabel = "Hello",
13+
passwordChangeLabel = "Update Password",
14+
administrationLabel = "Administration",
1215
logoPath,
1316
onLogin = () => {},
1417
onLogout = () => {},
@@ -35,7 +38,7 @@ const Header = ({
3538
</a>
3639
</div>
3740
{isOpen && (
38-
<UserMenu user={user} setIsOpen={setIsOpen} onLogin={onLogin} onLogout={onLogout}/>
41+
<UserMenu user={user} setIsOpen={setIsOpen} onLogin={onLogin} onLogout={onLogout} greetingLabel={greetingLabel} passwordChangeLabel={passwordChangeLabel} administrationLabel={administrationLabel} />
3942
)}
4043
</div>
4144
</header>

src/ui/icon/Icon.jsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import PropTypes from "prop-types";
33

4-
const Icon = ({ name = "home", size = 12, color = "black" }) => {
4+
const Icon = ({ name = "home", size = 12, color = "black", disableAnimation = false }) => {
55
const sizeClasses = {
66
4: "size-4",
77
6: "size-6",
@@ -15,14 +15,15 @@ const Icon = ({ name = "home", size = 12, color = "black" }) => {
1515

1616
const colorClasses = {
1717
"white": "text-white",
18-
"black": "text-black group-hover:text-white",
19-
"primary": "text-primary group-hover:text-white",
20-
"danger": "text-danger group-hover:text-white"
18+
"black": "text-black group-hover:text-black",
19+
"primary": "text-primary group-hover:text-primary",
20+
"danger": "text-danger group-hover:text-danger"
2121
}
2222

2323
const sizeClass = sizeClasses[size] || sizeClasses[12];
2424
const colorClass = colorClasses[color] || sizeClasses["black"];
25-
const className = ["transition transform duration-300 stroke-1 hover:scale-105",
25+
const animationClass = disableAnimation ? "" : "hover:scale-105";
26+
const className = ["transition transform duration-300 stroke-[1.3]", animationClass,
2627
colorClass, sizeClass].join(" ");
2728

2829
const icons = {
@@ -198,13 +199,22 @@ const Icon = ({ name = "home", size = 12, color = "black" }) => {
198199
<svg className={className} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor">
199200
<path strokeLinecap="round" strokeLinejoin="round" d="m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5" />
200201
</svg>
202+
),
203+
"exclamation-triangle": (
204+
<svg className={className} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor">
205+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
206+
</svg>),
207+
"exclamation-circle": (<svg className={className} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor">
208+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" />
209+
</svg>
201210
)
202211
}
203212

204213
Icon.propTypes = {
205214
name: PropTypes.oneOf(Object.keys(icons)),
206215
size: PropTypes.oneOf(Object.keys(sizeClasses)),
207-
color: PropTypes.oneOf(Object.keys(colorClasses))
216+
color: PropTypes.oneOf(Object.keys(colorClasses)),
217+
disableAnimation: PropTypes.bool
208218
}
209219

210220
const iconSvg = icons[name] || icons["home"];

src/ui/inputs/date/InputDate.stories.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
tags: ["autodocs"],
77
layout: "fullscreen",
88
args: {
9-
label: "Date :"
9+
label: "Date"
1010
}
1111
};
1212

0 commit comments

Comments
 (0)