Skip to content
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

V 3/tabs feedback #1315

Merged
merged 16 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c9db2a3
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 8, 2023
797a677
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 15, 2023
5bb31c4
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 15, 2023
9d7d7fb
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 16, 2023
e4751ef
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 16, 2023
c283ab2
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 21, 2023
035cfef
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 23, 2023
44b0366
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 23, 2023
f00815b
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 25, 2023
482e54e
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 30, 2023
bf7059a
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 4, 2023
362f940
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 5, 2023
9b91647
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 5, 2023
83fa048
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 6, 2023
0be815f
refine animation
svenvoskamp Sep 6, 2023
e8b28cc
Merge branch 'V3' of github.com:WalletConnect/web3modal into v-3/tabs…
svenvoskamp Sep 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions packages/ui/src/composites/wui-tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,29 @@ export class WuiTabs extends LitElement {
const activeBtnBounds = activeBtn?.getBoundingClientRect()
const activeBtnTextBounds = activeBtnText?.getBoundingClientRect()

if (passiveBtn && passiveBtnText && !initialAnimation) {
if (passiveBtn && passiveBtnText && !initialAnimation && index !== this.activeTab) {
animate(passiveBtnText, { opacity: 0 }, { duration: 0.25 })
animate(passiveBtn, { width: `20px` }, { duration: 0.25, delay: 0.05 })
animate(passiveBtn, { width: '34px' }, { duration: 0.5 })
}

if (activeBtn && activeBtnBounds && activeBtnTextBounds && activeBtnText) {
this.localTabWidth = `${Math.round(
activeBtnBounds.width + activeBtnTextBounds.width + 6 + 12
)}px`

animate(
activeBtn,
{ width: `${activeBtnBounds.width + activeBtnTextBounds.width + 6}px` },
{ duration: initialAnimation ? 0 : 0.5, delay: initialAnimation ? 0 : 0.1 }
)

animate(
activeBtnText,
{ opacity: 1 },
{ duration: initialAnimation ? 0 : 0.25, delay: initialAnimation ? 0 : 0.15 }
)
if (index !== this.activeTab || initialAnimation) {
this.localTabWidth = `${
Math.round(activeBtnBounds.width + activeBtnTextBounds.width) + 6
}px`

animate(
activeBtn,
{ width: `${activeBtnBounds.width + activeBtnTextBounds.width}px` },
{ duration: initialAnimation ? 0 : 0.5 }
)

animate(
activeBtnText,
{ opacity: 1 },
{ duration: initialAnimation ? 0 : 0.25, delay: initialAnimation ? 0 : 0.05 }
)
}
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions packages/ui/src/composites/wui-tabs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ export default css`
}

:host([data-type='flex'])::before {
transform: translateX(calc(var(--local-tab) * var(--local-tab-width) / 1.85));
left: 3px;
transform: translateX(calc((var(--local-tab) * 34px) + (var(--local-tab) * 4px)));
}

:host([data-type='flex']) {
display: flex;
padding: 0px 12px;
gap: 28px;
padding: 0px 0px 0px 12px;
gap: 4px;
}

:host([data-type='flex']) > button > wui-text {
Expand Down Expand Up @@ -64,7 +65,7 @@ export default css`
}

:host([data-type='flex']) > button {
width: 20px;
width: 34px;
position: relative;
display: flex;
justify-content: flex-start;
Expand Down