diff --git a/.prettierrc b/.prettierrc index 3e189a360..edcba88d1 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "singleQuote": true, "trailingComma": "all", - "printWidth": 140 + "printWidth": 150 } diff --git a/public/config.json b/public/config.json index 82192da25..e25db522a 100644 --- a/public/config.json +++ b/public/config.json @@ -4,18 +4,15 @@ }, "content": [ { - "backgroundColor": "#C105FA", "enableText": true, "featured": true, "playlistId": "CJE23b5T" }, { - "backgroundColor": "#C105FA", "enableText": true, "playlistId": "sR5VypYk" }, { - "backgroundColor": "#C105FA", "enableText": true, "playlistId": "o45EkQBf" } @@ -38,24 +35,13 @@ "options": { "dynamicBlur": true, "posterFading": true, - "backgroundColor": "#D42828", - "enableAddToHome": false, + "backgroundColor": null, + "shelveTitles": true, "enableContinueWatching": true, - "enableCookieNotice": false, - "enableHeader": true, - "enableInVideoSearch": false, - "highlightColor": "#CCCCCC", - "rightRail": { - "enabled": true - }, - "showcaseContentOnly": false, - "useRecommendationsPlaylist": true, - "videoTitlePosition": "above" + "highlightColor": null }, "player": "7xMa4gNw", "recommendationsPlaylist": "fuD6TWcf", "searchPlaylist": "tQ832H1H", - "siteName": "Blender", - "theme": "dark", - "version": "2" + "siteName": "Blender" } diff --git a/src/components/Animation/Animation.tsx b/src/components/Animation/Animation.tsx index 7d8ad3ac2..a8966feca 100644 --- a/src/components/Animation/Animation.tsx +++ b/src/components/Animation/Animation.tsx @@ -26,26 +26,31 @@ const Animation = ({ const seconds = duration / 1000; const transition = `transform ${seconds}s ease-out`; // todo: -webkit-transform; - const timeout = useRef(); - const timeout2 = useRef(); + const timeout = useRef(); + const timeout2 = useRef(); useEffect(() => { if (timeout.current) clearTimeout(timeout.current); if (timeout2.current) clearTimeout(timeout2.current); if (open) { setHasOpenedBefore(true); - timeout.current = setTimeout(() => setStatus('opening'), delay); - timeout2.current = setTimeout(() => { + timeout.current = window.setTimeout(() => setStatus('opening'), delay); + timeout2.current = window.setTimeout(() => { setStatus('open'); onOpenAnimationEnd && onOpenAnimationEnd(); }, duration + delay); } else if (hasOpenedBefore) { - timeout.current = setTimeout(() => setStatus('closing'), delay); - timeout2.current = setTimeout(() => { + timeout.current = window.setTimeout(() => setStatus('closing'), delay); + timeout2.current = window.setTimeout(() => { setStatus('closed'); onCloseAnimationEnd && onCloseAnimationEnd(); }, duration + delay); } + + return () => { + clearTimeout(timeout.current); + clearTimeout(timeout2.current); + }; }, [duration, delay, transition, open, onOpenAnimationEnd, onCloseAnimationEnd, hasOpenedBefore, setHasOpenedBefore]); if (!open && status === 'closed') { diff --git a/src/components/Button/Button.module.scss b/src/components/Button/Button.module.scss index 6c9e68770..a956ce570 100644 --- a/src/components/Button/Button.module.scss +++ b/src/components/Button/Button.module.scss @@ -25,6 +25,19 @@ $large-button-height: 40px; cursor: pointer; transition: background-color 0.1s ease, transform 0.1s ease; + @media (hover: hover) and (pointer: fine) { + &:hover, + &:focus { + transform: scale(1.1); + } + &:focus:not(:focus-visible):not(:hover) { + transform: scale(1); + } + &:focus-visible { + transform: scale(1.1); + } + } + &.large { height: $large-button-height; } @@ -35,15 +48,15 @@ $large-button-height: 40px; } &.primary { - color: var(--highlight-contrast-color, white); - background-color: var(--highlight-color, black); + color: var(--highlight-contrast-color, theme.$btn-primary-color); + background-color: var(--highlight-color, theme.$btn-primary-bg); } &.outlined { border: 1px solid rgba(255, 255, 255, 0.3); &.active, - &:focus { + &:focus-visible { color: var(--highlight-contrast-color, white); background-color: var(--highlight-color, black); border-color: var(--highlight-color); @@ -54,10 +67,10 @@ $large-button-height: 40px; background: none; opacity: 0.7; - &.active { + &.active, + &:focus { opacity: 1; } - &:hover { z-index: 1; background: theme.$btn-default-bg; @@ -79,13 +92,6 @@ $large-button-height: 40px; width: 18px; height: 18px; } - - @media (hover: hover) and (pointer: fine) { - &:hover, - &:focus { - transform: scale(1.06); - } - } } .startIcon { diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 4b7cda075..c7349cfc5 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -21,6 +21,7 @@ type Props = { size?: 'medium' | 'large'; to?: string; role?: string; + className?: string; } & React.AriaAttributes; const Button: React.FC = ({ @@ -34,9 +35,10 @@ const Button: React.FC = ({ size = 'medium', to, onClick, + className, ...rest }: Props) => { - const className = classNames(styles.button, [styles[color]], [styles[variant]], { + const combinedClassNames = classNames(styles.button, className, [styles[color]], [styles[variant]], { [styles.active]: active, [styles.fullWidth]: fullWidth, [styles.large]: size === 'large', @@ -46,13 +48,13 @@ const Button: React.FC = ({ const span = {label}; return to ? ( - + {icon} {span} {children} ) : ( -