Skip to content

Commit c433e1c

Browse files
authored
Merge pull request #123 from AppFlowy-IO/sprite_image
chore: use sprite image
2 parents 5c3b33d + fa8afc7 commit c433e1c

File tree

7 files changed

+860
-28
lines changed

7 files changed

+860
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ cypress/videos
4343

4444
.idea
4545
.claude
46+
.serena

components/shared/scroll-icons.tsx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,45 @@ function ScrollIcons() {
4949
<div className={'scroll-icons-title'}>Trusted by teams and individuals from</div>
5050
<div ref={scrollRef} className={'developers-logos'}>
5151
<div className={'logo-wrapper'}>
52-
{logos.map((item, index) => (
53-
<div
54-
key={index}
55-
style={{
56-
display: 'flex',
57-
width: '220px',
58-
height: '100px',
59-
padding: '30px 20px',
60-
flexDirection: 'column',
61-
justifyContent: 'center',
62-
alignItems: 'center',
63-
gap: '10px',
64-
borderRadius: '79px',
65-
background: 'rgba(245, 245, 250, 0.45)',
66-
color: 'var(--color-text)',
67-
}}
68-
className={'logo opacity-100'}
69-
>
70-
<img
71-
src={item.logo}
72-
className='opacity-60'
73-
alt={item.name}
52+
{logos.map((item, index) => {
53+
// Extract logo name from path (e.g., '/images/google.svg' -> 'google')
54+
const logoName = item.logo.replace('/images/', '').replace('.svg', '');
55+
56+
return (
57+
<div
58+
key={index}
7459
style={{
75-
filter:
76-
'brightness(0) saturate(100%) invert(7%) sepia(32%) saturate(2387%) hue-rotate(264deg) brightness(96%) contrast(104%)',
60+
display: 'flex',
61+
width: '220px',
62+
height: '100px',
63+
padding: '30px 20px',
64+
flexDirection: 'column',
65+
justifyContent: 'center',
66+
alignItems: 'center',
67+
gap: '10px',
68+
borderRadius: '79px',
69+
background: 'rgba(245, 245, 250, 0.45)',
70+
color: 'var(--color-text)',
7771
}}
78-
/>
79-
</div>
80-
))}
72+
className={'logo opacity-100'}
73+
>
74+
<svg
75+
className='opacity-60'
76+
style={{
77+
width: '100%',
78+
height: '100%',
79+
maxWidth: '160px',
80+
maxHeight: '50px',
81+
filter:
82+
'brightness(0) saturate(100%) invert(7%) sepia(32%) saturate(2387%) hue-rotate(264deg) brightness(96%) contrast(104%)',
83+
}}
84+
aria-label={item.name}
85+
>
86+
<use href={`/images/company-logos-sprite.svg#logo-${logoName}`} />
87+
</svg>
88+
</div>
89+
);
90+
})}
8191
</div>
8292
</div>
8393
</div>

dev.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ENVIRONMENT=test
2+
NEXT_PUBLIC_API_KEY=REQUIRED
3+
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
4+
NEXT_PUBLIC_SITE_BASE_URL=http://localhost:3000

next.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ const nextConfig = {
121121
source: '/(.*)',
122122
headers: securityHeaders,
123123
},
124+
{
125+
// Cache SVG sprite sheet for 1 year (immutable)
126+
source: '/images/company-logos-sprite.svg',
127+
headers: [
128+
{
129+
key: 'Cache-Control',
130+
value: 'public, max-age=31536000, immutable',
131+
},
132+
],
133+
},
124134
{
125135
source: '/:all*(docx)',
126136
headers: [

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",
1212
"test": "NODE_ENV=test cypress open",
1313
"test:headless": "NODE_ENV=test cypress run --browser chrome",
14-
"generate-sitemap": "node scripts/generate-sitemap.js"
14+
"generate-sitemap": "node scripts/generate-sitemap.js",
15+
"generate-sprite": "node scripts/generate-sprite.js"
1516
},
1617
"devDependencies": {
1718
"@types/lodash-es": "^4.17.8",

0 commit comments

Comments
 (0)