Skip to content

Commit 0f6f3ab

Browse files
committed
feat(Docs) Lightbox for images
1 parent 008a160 commit 0f6f3ab

File tree

4 files changed

+242
-1
lines changed

4 files changed

+242
-1
lines changed

app/globals.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,62 @@ body {
180180
content: "Step " counter(onboarding-step) ": ";
181181
font-weight: inherit;
182182
}
183+
184+
/* Lightbox animations */
185+
@keyframes dialog-content-show {
186+
from {
187+
opacity: 0;
188+
transform: translate(-50%, -48%) scale(0.96);
189+
}
190+
to {
191+
opacity: 1;
192+
transform: translate(-50%, -50%) scale(1);
193+
}
194+
}
195+
196+
@keyframes dialog-content-hide {
197+
from {
198+
opacity: 1;
199+
transform: translate(-50%, -50%) scale(1);
200+
}
201+
to {
202+
opacity: 0;
203+
transform: translate(-50%, -48%) scale(0.96);
204+
}
205+
}
206+
207+
@keyframes dialog-overlay-show {
208+
from {
209+
opacity: 0;
210+
}
211+
to {
212+
opacity: 1;
213+
}
214+
}
215+
216+
@keyframes dialog-overlay-hide {
217+
from {
218+
opacity: 1;
219+
}
220+
to {
221+
opacity: 0;
222+
}
223+
}
224+
225+
/* Target only image lightbox dialog content */
226+
.image-lightbox-content[data-state="open"] {
227+
animation: dialog-content-show 200ms cubic-bezier(0.16, 1, 0.3, 1);
228+
}
229+
230+
.image-lightbox-content[data-state="closed"] {
231+
animation: dialog-content-hide 200ms cubic-bezier(0.16, 1, 0.3, 1);
232+
}
233+
234+
/* Target only image lightbox dialog overlay */
235+
.image-lightbox-overlay[data-state="open"] {
236+
animation: dialog-overlay-show 200ms cubic-bezier(0.16, 1, 0.3, 1);
237+
}
238+
239+
.image-lightbox-overlay[data-state="closed"] {
240+
animation: dialog-overlay-hide 200ms cubic-bezier(0.16, 1, 0.3, 1);
241+
}

next.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ if (
5252
const nextConfig = {
5353
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx', 'mdx'],
5454
trailingSlash: true,
55+
images: {
56+
contentDispositionType: 'inline', // "open image in new tab" instead of downloading
57+
},
5558
serverExternalPackages: ['rehype-preset-minify'],
5659
outputFileTracingExcludes,
5760
webpack: (config, options) => {
@@ -71,7 +74,7 @@ const nextConfig = {
7174
DEVELOPER_DOCS_: process.env.NEXT_PUBLIC_DEVELOPER_DOCS,
7275
},
7376
redirects,
74-
rewrites: async () => [
77+
rewrites: () => [
7578
{
7679
source: '/:path*.md',
7780
destination: '/md-exports/:path*.md',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@popperjs/core": "^2.11.8",
5050
"@prettier/plugin-xml": "^3.3.1",
5151
"@radix-ui/colors": "^3.0.0",
52+
"@radix-ui/react-dialog": "^1.1.14",
5253
"@radix-ui/react-collapsible": "^1.1.1",
5354
"@radix-ui/react-dropdown-menu": "^2.1.2",
5455
"@radix-ui/react-icons": "^1.3.2",

0 commit comments

Comments
 (0)