-
Notifications
You must be signed in to change notification settings - Fork 5
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
style: change colors and spaces #1611
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd9d4d9
style: change colors and spaces
Nick-1979 671c02f
chore: add accessibility, prefersReducedMotion
Nick-1979 fffb353
fix: align account settings menu dividers
Nick-1979 74416ba
style: align colors and width of sub-menu's divider
Nick-1979 4afc6d3
style: adjust theme icon left
Nick-1979 b2f80ab
chore: remove unused
Nick-1979 a6bb58c
fix: show identicon if formatted is undefined
Nick-1979 9b05146
fix: handle when no background image has been set
Nick-1979 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 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 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 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
43 changes: 39 additions & 4 deletions
43
packages/extension-polkagate/src/components/VaadinIcon.tsx
This file contains 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 |
---|---|---|
@@ -1,16 +1,51 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// @ts-nocheck | ||
|
||
import React from 'react'; | ||
import '@vaadin/icons'; | ||
|
||
import React, { useEffect } from 'react'; | ||
|
||
interface VaadinIconProps extends React.HTMLAttributes<HTMLElement> { | ||
icon: string; | ||
spin?: boolean; | ||
float?: boolean; | ||
} | ||
|
||
const VaadinIcon: React.FC<VaadinIconProps> = ({ icon, ...props }) => { | ||
return <vaadin-icon icon={icon} {...props} />; | ||
const VaadinIcon: React.FC<VaadinIconProps> = ({ float = false, icon, spin = false, style, ...props }) => { | ||
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; | ||
|
||
useEffect(() => { | ||
// Check if the animations are already injected | ||
if (!document.getElementById('vaadin-icon-animation-keyframes')) { | ||
const styleSheet = document.createElement('style'); | ||
|
||
styleSheet.id = 'vaadin-icon-animation-keyframes'; | ||
styleSheet.innerText = ` | ||
@keyframes vaadinSpin { | ||
from { transform: rotate(0deg); } | ||
to { transform: rotate(360deg); } | ||
} | ||
@keyframes float { | ||
0%, 100% { transform: translateY(0); } | ||
50% { transform: translateY(-4px); } | ||
} | ||
`; | ||
document.head.appendChild(styleSheet); | ||
} | ||
}, []); | ||
Nick-1979 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Combine inline styles with the animations if enabled | ||
const combinedStyles: React.CSSProperties = { | ||
animation: `${spin && !prefersReducedMotion ? 'vaadinSpin 3s linear infinite' : ''} ${float && !prefersReducedMotion ? 'float 2s ease-in-out infinite' : ''}`, | ||
...style | ||
}; | ||
|
||
// @ts-ignore | ||
return <vaadin-icon | ||
icon={icon} | ||
style={combinedStyles} | ||
{...props} | ||
/>; | ||
}; | ||
|
||
export default VaadinIcon; |
This file contains 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 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 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 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 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 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.
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.
💡 Codebase verification
Type restriction on iconTheme is a breaking change
The search results show that
iconTheme
prop is widely used throughout the codebase with string values, specifically:chain?.icon || 'polkadot'
as the iconThemeChanging the type from
IconTheme | string
to justIconTheme
would break these existing usages. The type should continue to support string values to maintain compatibility.🔗 Analysis chain
Verify usage of string-based icon themes.
The type restriction from
IconTheme | string
toIconTheme
improves type safety but could be a breaking change if string values were being passed to this prop.Let's verify all usages of this component with the iconTheme prop:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 33
Script:
Length of output: 5402