@ilo-org/react 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ilo-org/react
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8bc52db6e]
|
|
8
|
+
- @ilo-org/styles@0.3.0
|
|
9
|
+
|
|
10
|
+
## 0.4.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bac3cc9d5: Fix bug preventing the sub-brand from rendering with the proper font size on some mobile browsers
|
|
15
|
+
- Updated dependencies [bac3cc9d5]
|
|
16
|
+
- @ilo-org/styles@0.2.1
|
|
17
|
+
|
|
3
18
|
## 0.4.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -33,6 +33,8 @@ const BaseLogo = (_a) => {
|
|
|
33
33
|
const lockupRef = require$$0.useRef(null);
|
|
34
34
|
// The lockup text
|
|
35
35
|
const lockupTextRef = require$$0.useRef(null);
|
|
36
|
+
// Initial height of the image when it's loaded
|
|
37
|
+
const initialImageHeight = require$$0.useRef(null);
|
|
36
38
|
// Has the image loaded or not
|
|
37
39
|
const [imageLoaded, setImageLoaded] = require$$0.useState(false);
|
|
38
40
|
// Dynamic height of the image
|
|
@@ -41,8 +43,6 @@ const BaseLogo = (_a) => {
|
|
|
41
43
|
const [fontSizeRatio, setfontSizeRatio] = require$$0.useState(0);
|
|
42
44
|
// Is the logo visible? Default to true if not a subbrand
|
|
43
45
|
const [isLogoVisible, setIsLogoVisible] = require$$0.useState(!subbrand);
|
|
44
|
-
// Initial height of the image when it's loaded
|
|
45
|
-
const initialImageHeight = require$$0.useRef(null);
|
|
46
46
|
// Resize observer gets the initial height of the image when
|
|
47
47
|
// it loads and updates the height when it changes in state
|
|
48
48
|
const observer = require$$0.useRef(new ResizeObserver((entries) => {
|
|
@@ -59,7 +59,7 @@ const BaseLogo = (_a) => {
|
|
|
59
59
|
}
|
|
60
60
|
}, [imageLoaded, fontSizeRatio, subbrand]);
|
|
61
61
|
// Set up the Resize observer to watch the image
|
|
62
|
-
require$$0.
|
|
62
|
+
require$$0.useLayoutEffect(() => {
|
|
63
63
|
if (imageLoaded && lockupRef.current && imageRef.current) {
|
|
64
64
|
const imageEl = imageRef.current;
|
|
65
65
|
observer.current.observe(imageEl);
|
|
@@ -70,12 +70,12 @@ const BaseLogo = (_a) => {
|
|
|
70
70
|
// the lockup container as much as possible without overflowing.
|
|
71
71
|
// Then gets the ratio of full font size to image height which will
|
|
72
72
|
// be used to calculate the font size if the image gets resized
|
|
73
|
-
require$$0.
|
|
73
|
+
require$$0.useLayoutEffect(() => {
|
|
74
74
|
setFontSize();
|
|
75
75
|
}, [imageLoaded, initialImageHeight.current]);
|
|
76
76
|
// Adjust the font size if for some weird reason the subbrand changes
|
|
77
77
|
// This is mostly just to illustrate how the component works on Storybook
|
|
78
|
-
require$$0.
|
|
78
|
+
require$$0.useLayoutEffect(() => {
|
|
79
79
|
setFontSize();
|
|
80
80
|
}, [subbrand]);
|
|
81
81
|
function setFontSize() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
|
4
4
|
import useGlobalSettings from '../../hooks/useGlobalSettings.js';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import '../../GlobalCtx-7fb23cfa.js';
|
|
@@ -31,6 +31,8 @@ const BaseLogo = (_a) => {
|
|
|
31
31
|
const lockupRef = useRef(null);
|
|
32
32
|
// The lockup text
|
|
33
33
|
const lockupTextRef = useRef(null);
|
|
34
|
+
// Initial height of the image when it's loaded
|
|
35
|
+
const initialImageHeight = useRef(null);
|
|
34
36
|
// Has the image loaded or not
|
|
35
37
|
const [imageLoaded, setImageLoaded] = useState(false);
|
|
36
38
|
// Dynamic height of the image
|
|
@@ -39,8 +41,6 @@ const BaseLogo = (_a) => {
|
|
|
39
41
|
const [fontSizeRatio, setfontSizeRatio] = useState(0);
|
|
40
42
|
// Is the logo visible? Default to true if not a subbrand
|
|
41
43
|
const [isLogoVisible, setIsLogoVisible] = useState(!subbrand);
|
|
42
|
-
// Initial height of the image when it's loaded
|
|
43
|
-
const initialImageHeight = useRef(null);
|
|
44
44
|
// Resize observer gets the initial height of the image when
|
|
45
45
|
// it loads and updates the height when it changes in state
|
|
46
46
|
const observer = useRef(new ResizeObserver((entries) => {
|
|
@@ -57,7 +57,7 @@ const BaseLogo = (_a) => {
|
|
|
57
57
|
}
|
|
58
58
|
}, [imageLoaded, fontSizeRatio, subbrand]);
|
|
59
59
|
// Set up the Resize observer to watch the image
|
|
60
|
-
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
61
|
if (imageLoaded && lockupRef.current && imageRef.current) {
|
|
62
62
|
const imageEl = imageRef.current;
|
|
63
63
|
observer.current.observe(imageEl);
|
|
@@ -68,12 +68,12 @@ const BaseLogo = (_a) => {
|
|
|
68
68
|
// the lockup container as much as possible without overflowing.
|
|
69
69
|
// Then gets the ratio of full font size to image height which will
|
|
70
70
|
// be used to calculate the font size if the image gets resized
|
|
71
|
-
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
72
|
setFontSize();
|
|
73
73
|
}, [imageLoaded, initialImageHeight.current]);
|
|
74
74
|
// Adjust the font size if for some weird reason the subbrand changes
|
|
75
75
|
// This is mostly just to illustrate how the component works on Storybook
|
|
76
|
-
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
77
|
setFontSize();
|
|
78
78
|
}, [subbrand]);
|
|
79
79
|
function setFontSize() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "React components for the ILO's Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui_patterns",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@ilo-org/brand-assets": "0.1.0",
|
|
76
76
|
"@ilo-org/fonts": "0.1.0",
|
|
77
77
|
"@ilo-org/icons-react": "0.0.18",
|
|
78
|
-
"@ilo-org/styles": "0.
|
|
78
|
+
"@ilo-org/styles": "0.3.0",
|
|
79
79
|
"@ilo-org/themes": "0.1.15",
|
|
80
80
|
"@ilo-org/utils": "0.0.11"
|
|
81
81
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
1
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { useGlobalSettings } from "../../hooks";
|
|
3
3
|
import { InnerLogoProps, LogoProps } from "./Logo.props";
|
|
4
4
|
import classnames from "classnames";
|
|
@@ -55,6 +55,9 @@ const BaseLogo: React.FC<InnerLogoProps> = ({
|
|
|
55
55
|
// The lockup text
|
|
56
56
|
const lockupTextRef = useRef<HTMLSpanElement>(null);
|
|
57
57
|
|
|
58
|
+
// Initial height of the image when it's loaded
|
|
59
|
+
const initialImageHeight = useRef<null | number>(null);
|
|
60
|
+
|
|
58
61
|
// Has the image loaded or not
|
|
59
62
|
const [imageLoaded, setImageLoaded] = useState(false);
|
|
60
63
|
|
|
@@ -67,9 +70,6 @@ const BaseLogo: React.FC<InnerLogoProps> = ({
|
|
|
67
70
|
// Is the logo visible? Default to true if not a subbrand
|
|
68
71
|
const [isLogoVisible, setIsLogoVisible] = useState(!subbrand);
|
|
69
72
|
|
|
70
|
-
// Initial height of the image when it's loaded
|
|
71
|
-
const initialImageHeight = useRef<null | number>(null);
|
|
72
|
-
|
|
73
73
|
// Resize observer gets the initial height of the image when
|
|
74
74
|
// it loads and updates the height when it changes in state
|
|
75
75
|
const observer = useRef(
|
|
@@ -90,7 +90,7 @@ const BaseLogo: React.FC<InnerLogoProps> = ({
|
|
|
90
90
|
}, [imageLoaded, fontSizeRatio, subbrand]);
|
|
91
91
|
|
|
92
92
|
// Set up the Resize observer to watch the image
|
|
93
|
-
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
94
|
if (imageLoaded && lockupRef.current && imageRef.current) {
|
|
95
95
|
const imageEl = imageRef.current;
|
|
96
96
|
observer.current.observe(imageEl);
|
|
@@ -102,13 +102,13 @@ const BaseLogo: React.FC<InnerLogoProps> = ({
|
|
|
102
102
|
// the lockup container as much as possible without overflowing.
|
|
103
103
|
// Then gets the ratio of full font size to image height which will
|
|
104
104
|
// be used to calculate the font size if the image gets resized
|
|
105
|
-
|
|
105
|
+
useLayoutEffect(() => {
|
|
106
106
|
setFontSize();
|
|
107
107
|
}, [imageLoaded, initialImageHeight.current]);
|
|
108
108
|
|
|
109
109
|
// Adjust the font size if for some weird reason the subbrand changes
|
|
110
110
|
// This is mostly just to illustrate how the component works on Storybook
|
|
111
|
-
|
|
111
|
+
useLayoutEffect(() => {
|
|
112
112
|
setFontSize();
|
|
113
113
|
}, [subbrand]);
|
|
114
114
|
|