Repository navigation
fix(website): scale hero mocks to the viewport width #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ef74c55
fix(website): scale hero mocks to the viewport instead of reflowing
Waishnav dac7c2c
fix(website): scale the docs delegation diagram to the viewport
Waishnav 1e18d86
fix(website): add previews block so Workers Builds can deploy branch …
Waishnav 504d144
chore(website): enable Workers logs observability
Waishnav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { useLayoutEffect, useRef, useState, type ReactNode } from "react"; | ||
|
|
||
| // Lays children out at a fixed design width and scales them down to the | ||
| // available width, so an illustration reads like a recording on any screen | ||
| // instead of reflowing. | ||
| export default function Fit({ width, children }: { width: number; children: ReactNode }) { | ||
| const outer = useRef<HTMLDivElement>(null); | ||
| const inner = useRef<HTMLDivElement>(null); | ||
| const [scale, setScale] = useState(1); | ||
| const [height, setHeight] = useState<number>(); | ||
|
|
||
| useLayoutEffect(() => { | ||
| const measure = () => { | ||
| setScale(Math.min(1, outer.current!.clientWidth / width)); | ||
| setHeight(inner.current!.offsetHeight); | ||
| }; | ||
| measure(); | ||
| const observer = new ResizeObserver(measure); | ||
| observer.observe(outer.current!); | ||
| observer.observe(inner.current!); | ||
| return () => observer.disconnect(); | ||
| }, [width]); | ||
|
|
||
| return ( | ||
| <div ref={outer} style={{ height: height === undefined ? undefined : height * scale, overflow: "hidden" }}> | ||
| <div ref={inner} style={{ width, display: "flow-root", transform: `scale(${scale})`, transformOrigin: "top left" }}> | ||
| {children} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: Waishnav/devspace
Length of output: 24279
Web query:
Cloudflare Workers static assets only deployment asset requests Worker invocation logs HTTP request logs observability invocation_logsResult:
Web query:
site:developers.cloudflare.com/workers/static-assets asset-only Worker requests do not invoke Worker static assetsResult:
Use an HTTP request log source for static asset traffic.
Matching assets bypass Worker code, so
observability.logs.invocation_logsdoes not record the site’s asset requests. Configure Cloudflare’s HTTP Requests Logpush dataset, or add a Worker and route requests through it withrun_worker_firstif Worker-based logs are required.