Closed gkoscky closed 11 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
flashbots-writings-website | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Dec 20, 2023 5:15pm |
Adding a new
DuneDashboard
component to let you embed a Dune dashboard to a blog post. Well, technically any embedding. Example:The component gives you control over:
Instructions
Follow these steps to use the component in your post:
Import the component Add the following line to your blog post file after all the headers, as shown in the example above:
Get the embedded URL from Dune When viewing a dashboard you can click the "Share" button to see the option to "Embed Iframe". What we want is the
src
property from the providediframe
. Select and copy that URL to use with the component.Add a component to your blog post Add a
DuneDashboard
component to your post using the URL you just copied as thesource
parameter:Add a label - optional If you'd like to provide some context on what the dashboard is showing, you can add a
label
option to the component. The label can be plain text or HTML.HTML labels need to be surrounded by
{<>…</>}
The label is optional. If you omit it, the dashboard will still appear.
Customize the proportions - optional All dashboards are the same width but you can control how tall it is using the
aspectRatio
option.By default all dashboards have a squareish 16/13 aspect ratio and you can make it taller or shorter by altering that ratio. For instance, a 16/5 aspect ratio would make for a shorter dashboard, while a 16/18 ratio would mean a taller one.
The custom aspect ratio is optional. If you omit it, the component will default to 16/13.
Note on mobile view
The embedded dashboards will adapt to narrow phone screens to some extent, but Dune's support for it isn't great. The legend might overlap with the graph, or disappear entirely if there's not enough space.
It is strongly recommended that you test how the page looks on a phone screen and tweak the aspect ratio for any given dashboard accordingly. Sometimes it helps. Sometimes it doesn't. But it's important to keep that in mind.
If all else fails, a good label will get you very far:
As a last tip, you can use your browser's Dev Tools to mess with the page's dimensions, to simulate a phone screen! In Chrome, on Mac, you can hit
⌘+⌥+i
to open Dev Tools, then⌘+⇧+m
to turn on the mobile view simulator.