Skip to content

Commit 0ec45e4

Browse files
authored
update storybook links to use base's chromatic account (#6)
* update storybook links to use base's chromatic account * add tailwind config file * generate storybook on each commit * update App container and fix SubAccoun bugt * romove layout * add back the centered layout * update iframe * fix stories * update heights
1 parent fa8c452 commit 0ec45e4

File tree

83 files changed

+569
-571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+569
-571
lines changed

.github/workflows/chromatic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: "Chromatic Publish"
22

33
on:
44
push:
5-
branches:
6-
- master
5+
paths:
6+
- "storybook/**"
77

88
jobs:
99
test:

docs/cookbook/defi-your-app.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Lets add the `Swap` component to your app.
6767
You should now see the following swap component in your app:
6868

6969
<iframe
70-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-swap-wallet--not-connected&viewMode=story&dark=true&hero=true"
70+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-swap-wallet--not-connected&viewMode=story&dark=true&hero=true"
7171
width="100%"
7272
height="auto"
7373
/>
@@ -126,7 +126,7 @@ import { Earn } from '@coinbase/onchainkit/earn'; // [!code focus]
126126
Just like that, you've added a yield-generating vault to your app.
127127

128128
<iframe
129-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-earn--main&viewMode=story&dark=true&hero=true"
129+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-earn--main&viewMode=story&dark=true&hero=true"
130130
width="100%"
131131
height="400px"
132132
/>
@@ -190,7 +190,7 @@ function CustomDepositButtons() {
190190
</CodeGroup>
191191

192192
<iframe
193-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-earn--predefined-deposit&viewMode=story&dark=true&hero=true"
193+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-earn--predefined-deposit&viewMode=story&dark=true&hero=true"
194194
width="100%"
195195
height="280px"
196196
/>
@@ -223,7 +223,7 @@ import { FundCard } from '@coinbase/onchainkit/fund';
223223
```
224224

225225
<iframe
226-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-fundcard--default&viewMode=story&dark=true&hero=true"
226+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-fundcard--default&viewMode=story&dark=true&hero=true"
227227
width="100%"
228228
height="370px"
229229
/>
@@ -284,7 +284,7 @@ export default function BuyComponents() { // [!code focus]
284284
```
285285

286286
<iframe
287-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-buy--disabled&viewMode=story&dark=true&hero=true"
287+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-buy--disabled&viewMode=story&dark=true&hero=true"
288288
width="100%"
289289
height="auto"
290290
/>

docs/cookbook/onboard-any-user.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Lets add the `WalletModal` component to your app.
9393
</Steps>
9494

9595
<iframe
96-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=onchainkit-wallet-walletcomponents--onboard&viewMode=story&dark=true&hero=true"
96+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=onchainkit-wallet-walletcomponents--onboard&viewMode=story&dark=true&hero=true"
9797
width="100%"
9898
height="auto"
9999
/>

docs/iframe-theme.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
(function () {
22
function updateIframesForDarkMode() {
33
const isDark = document.documentElement.classList.contains("dark");
4-
console.log("Dark mode:", isDark);
54

65
document.querySelectorAll('iframe[src*="chromatic.com/iframe.html"]').forEach((iframe) => {
76
iframe.style.background = "transparent";
87
iframe.allowTransparency = true;
9-
console.log("Found iframe:", iframe.src);
108

119
// Use postMessage to communicate with the iframe since we can't access contentDocument due to CORS
1210
const sendThemeMessage = () => {
@@ -18,7 +16,6 @@
1816
background: isDark ? '#0b0d0f' : 'transparent' // transparent for light mode
1917
}
2018
};
21-
console.log("Sending theme message to iframe:", message);
2219
iframe.contentWindow.postMessage(message, '*');
2320
} catch (e) {
2421
console.warn("Could not send message to iframe:", e);
@@ -30,7 +27,6 @@
3027

3128
// Also send message when iframe loads
3229
iframe.addEventListener("load", () => {
33-
console.log("iframe loaded, sending theme message");
3430
// Add a small delay to ensure iframe is ready
3531
setTimeout(sendThemeMessage, 100);
3632
});
@@ -43,7 +39,6 @@
4339
if (mutation.type === 'attributes' &&
4440
mutation.attributeName === 'class' &&
4541
mutation.target === document.documentElement) {
46-
console.log("Theme class changed, updating iframes");
4742
updateIframesForDarkMode();
4843
}
4944
});
@@ -57,6 +52,16 @@
5752
if (document.readyState === "loading") {
5853
document.addEventListener("DOMContentLoaded", updateIframesForDarkMode);
5954
} else {
60-
updateIframesForDarkMode();
55+
setTimeout(updateIframesForDarkMode, 100);
56+
// TODO: add Storybook with Darkmode enabled
57+
let themeChangeCount = 0;
58+
const themeChangeInterval = setInterval(() => {
59+
if (themeChangeCount < 2) {
60+
updateIframesForDarkMode();
61+
themeChangeCount++;
62+
} else {
63+
clearInterval(themeChangeInterval);
64+
}
65+
}, 1000);
6166
}
6267
})();

docs/learn/arrays/arrays-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ As these are separate networks with separate data, your NFTs **will not** transf
8787
{/* <CafeUnitTest nftNum={4}/> */}
8888

8989
<iframe
90-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--four&viewMode=story&dark=true&hero=true"
90+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--four&viewMode=story&dark=true&hero=true"
9191
width="100%"
9292
height="auto"
9393
/>

docs/learn/control-structures/control-structures-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ As these are separate networks with separate data, your NFTs **will not** transf
5151
{/* <CafeUnitTest nftNum={2}/> */}
5252

5353
<iframe
54-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--two&viewMode=story&dark=true&hero=true"
54+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--two&viewMode=story&dark=true&hero=true"
5555
width="100%"
5656
height="auto"
5757
/>

docs/learn/deployment-to-testnet/deployment-to-testnet-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ As these are separate networks with separate data, your NFTs **will not** transf
3030
{/* <CafeUnitTest nftNum={1}/> */}
3131

3232
<iframe
33-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--one&viewMode=story&dark=true&hero=true"
33+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--one&viewMode=story&dark=true&hero=true"
3434
width="100%"
3535
height="auto"
3636
/>

docs/learn/erc-20-token/erc-20-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The contract specification contains actions that can only be performed once by a
118118
{/* <CafeUnitTest nftNum={14}/> */}
119119

120120
<iframe
121-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--fourteen&viewMode=story&dark=true&hero=true"
121+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--fourteen&viewMode=story&dark=true&hero=true"
122122
width="100%"
123123
height="auto"
124124
/>

docs/learn/erc-721-token/erc-721-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ As these are separate networks with separate data, your NFTs **will not** transf
8181
{/* <CafeUnitTest nftNum={15}/> */}
8282

8383
<iframe
84-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--fiftteen&viewMode=story&dark=true&hero=true"
84+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--fiftteen&viewMode=story&dark=true&hero=true"
8585
width="100%"
8686
height="auto"
8787
/>

docs/learn/error-triage/error-triage-exercise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ As these are separate networks with separate data, your NFTs **will not** transf
9191
{/* <CafeUnitTest nftNum={10}/> */}
9292

9393
<iframe
94-
src="https://682cef8eb764086a250fb541-zdfthryttt.chromatic.com/iframe.html?args=&id=components-cafeunittest--ten&viewMode=story&dark=true&hero=true"
94+
src="https://684b5e62b1ff46bc5bf83966-aijszlfakk.chromatic.com/iframe.html?args=&id=components-cafeunittest--ten&viewMode=story&dark=true&hero=true"
9595
width="100%"
9696
height="auto"
9797
/>

0 commit comments

Comments
 (0)