Skip to content

Commit

Permalink
[patch] Add css reset (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
toddkao authored Jul 16, 2024
1 parent fd95dba commit 8250a67
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-mails-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@skip-go/widget': patch
---

Add cssReset to widget
10 changes: 9 additions & 1 deletion examples/nextjs/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ body {
}

input {
background-color: black;
background: black;
}

div,
p,
span {
color: gray;
border: 2px solid gray;
background: gray;
}
27 changes: 27 additions & 0 deletions packages/widget/src/styles/cssReset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Reset relevant styles within Shadow DOM */
* {
font-family: unset;
font-style: unset;
font-weight: unset;
text-align: revert;
text-decoration: unset;
text-indent: unset;
text-transform: unset;
line-height: unset;
letter-spacing: unset;
white-space: unset;
box-sizing: border-box;
margin: unset;
padding: unset;
visibility: unset;
float: unset;
clear: unset;
background-color: unset;
word-spacing: unset;
}

div,
p,
span {
color: black;
}
5 changes: 4 additions & 1 deletion packages/widget/src/ui/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ export const SwapWidgetUI = ({
}
}}
>
<div key={accountStateKey} className="animate-slide-up-and-fade">
<div
key={accountStateKey}
className="animate-slide-up-and-fade text-white"
>
{!srcAccount?.isWalletConnected && 'Connect Wallet'}
</div>
</button>
Expand Down
3 changes: 2 additions & 1 deletion packages/widget/src/ui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { SwapWidgetUI } from './Widget';
import shadowDomStyles from '../styles/shadowDomStyles.css';
import toastStyles from '../styles/toastStyles.css';
import cssReset from '../styles/cssReset.css';
import { Scope } from 'react-shadow-scope';
import { useInjectFontsToDocumentHead } from '../hooks/use-inject-fonts-to-document-head';

Expand Down Expand Up @@ -42,7 +43,7 @@ export const SwapWidget: React.FC<SwapWidgetProps> = ({

return (
<Scope
stylesheets={[toastStyles, shadowDomStyles]}
stylesheets={[cssReset, toastStyles, shadowDomStyles]}
config={{ dsd: 'emulated' }}
>
<SwapWidgetProvider {...swapWidgetProviderProps}>
Expand Down

0 comments on commit 8250a67

Please sign in to comment.