Skip to content

Commit 8ec80d1

Browse files
fix: light theme in docs/play logo in loop (#1041)
## Description <!-- Provide a concise and descriptive summary of the changes implemented in this PR. --> ### Introduces a breaking change? - [ ] Yes - [ ] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [ ] iOS - [ ] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [ ] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent cbffa44 commit 8ec80d1

File tree

2 files changed

+6
-43
lines changed

2 files changed

+6
-43
lines changed

docs/src/components/Hero/StartScreen/Logo.tsx

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
import React, { useRef, useEffect, useState } from 'react';
1+
import React from 'react';
22
import useScreenSize from '@site/src/hooks/useScreenSize';
33
import useBaseUrl from '@docusaurus/useBaseUrl';
44

55
const Logo = () => {
66
const { windowWidth } = useScreenSize();
77
const gifUrl = useBaseUrl('/img/logo-hero-flame.gif');
8-
const canvasRef = useRef<HTMLCanvasElement>(null);
9-
const [showCanvas, setShowCanvas] = useState(false);
10-
11-
useEffect(() => {
12-
if (!canvasRef.current) return;
13-
14-
const canvas = canvasRef.current;
15-
const ctx = canvas.getContext('2d');
16-
if (!ctx) return;
17-
18-
const img = new Image();
19-
img.crossOrigin = 'anonymous';
20-
img.src = gifUrl;
21-
22-
img.onload = () => {
23-
canvas.width = img.naturalWidth;
24-
canvas.height = img.naturalHeight;
25-
26-
// Calculate GIF duration (approximate based on typical frame rates)
27-
// Adjust this timeout to match your GIF's actual duration
28-
const gifDuration = 7500; // milliseconds - adjust as needed!
29-
30-
setTimeout(() => {
31-
// Draw the final frame
32-
ctx.drawImage(img, 0, 0);
33-
setShowCanvas(true);
34-
}, gifDuration);
35-
};
36-
}, [gifUrl]);
378

389
if (windowWidth <= 768) {
3910
return null;
@@ -44,19 +15,7 @@ const Logo = () => {
4415
<img
4516
src={gifUrl}
4617
alt="React Native ExecuTorch 🔥💀"
47-
style={{
48-
maxWidth: '400px',
49-
width: '100%',
50-
display: showCanvas ? 'none' : 'block',
51-
}}
52-
/>
53-
<canvas
54-
ref={canvasRef}
55-
style={{
56-
maxWidth: '400px',
57-
width: '100%',
58-
display: showCanvas ? 'block' : 'none',
59-
}}
18+
style={{ maxWidth: '400px', width: '100%' }}
6019
/>
6120
</div>
6221
);

docs/src/components/Hero/StartScreen/styles.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
display: flex;
55
min-height: 100vh;
66
align-items: center;
7+
background-color: #ffffff;
8+
}
9+
10+
[data-theme='dark'] .hero {
711
background-color: #130302;
812
}
913

0 commit comments

Comments
 (0)