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

Fix styles general #3356

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/src/common/pure/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Wrapper = styled.div<Omit<IconProps, 'image'>>`

export function Icon({
image,
size = 16,
size = 24,
bgColor,
color,
description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export enum BannerOrientation {

export function BundleTxApprovalBanner() {
return (
<InlineBanner bannerType="information">
<InlineBanner bannerType="information" iconSize={32}>
<strong>Token approval bundling</strong>
<p>
For your convenience, token approval and order placement will be bundled into a single transaction, streamlining
Expand All @@ -32,7 +32,7 @@ export type BundleTxWrapBannerProps = {

export function BundleTxWrapBanner({ nativeCurrencySymbol, wrappedCurrencySymbol }: BundleTxWrapBannerProps) {
return (
<InlineBanner bannerType="information">
<InlineBanner bannerType="information" iconSize={32}>
<strong>Token wrapping bundling</strong>
<p>
For your convenience, CoW Swap will bundle all the necessary actions for this trade into a single transaction.
Expand All @@ -54,7 +54,7 @@ export function BundleTxSafeWcBanner({ nativeCurrencySymbol, supportsWrapping }:
const supportsWrappingText = supportsWrapping ? `${nativeCurrencySymbol} wrapping, ` : ''

return (
<InlineBanner bannerType="information">
<InlineBanner bannerType="information" iconSize={32}>
<strong>Use Safe web app</strong>
<p>
Use the Safe web app for streamlined trading: {supportsWrappingText}token approval and orders bundled in one go!
Expand All @@ -71,7 +71,7 @@ export type SmallVolumeWarningBannerProps = {

export function SmallVolumeWarningBanner({ feePercentage, feeAmount }: SmallVolumeWarningBannerProps) {
return (
<InlineBanner>
<InlineBanner iconSize={32}>
<strong>Small orders are unlikely to be executed</strong>
<p>
For this order, network fees would be{' '}
Expand Down
17 changes: 9 additions & 8 deletions apps/cowswap-frontend/src/common/pure/InlineBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ interface ColorEnums {
const colorEnumsMap: Record<BannerType, ColorEnums> = {
alert: {
icon: IconType.ALERT,
color: UI.COLOR_ALERT,
color: UI.COLOR_ALERT_TEXT,
bg: UI.COLOR_ALERT_BG,
text: UI.COLOR_ALERT_TEXT,
},
information: {
icon: IconType.INFORMATION,
color: UI.COLOR_INFORMATION,
color: UI.COLOR_INFORMATION_TEXT,
bg: UI.COLOR_INFORMATION_BG,
text: UI.COLOR_INFORMATION_TEXT,
},
success: {
icon: IconType.SUCCESS,
color: UI.COLOR_SUCCESS,
color: UI.COLOR_SUCCESS_TEXT,
bg: UI.COLOR_SUCCESS_BG,
text: UI.COLOR_SUCCESS_TEXT,
},
danger: {
icon: IconType.DANGER,
color: UI.COLOR_DANGER,
color: UI.COLOR_DANGER_TEXT,
bg: UI.COLOR_DANGER_BG,
text: UI.COLOR_DANGER_TEXT,
},
savings: {
iconText: '💸',
color: UI.COLOR_SUCCESS,
color: UI.COLOR_SUCCESS_TEXT,
bg: UI.COLOR_SUCCESS_BG,
text: UI.COLOR_SUCCESS_TEXT,
},
Expand Down Expand Up @@ -128,14 +128,15 @@ export function InlineBanner({
children,
className,
hideIcon,
bannerType = 'alert',
bannerType,
borderRadius,
orientation,
iconSize,
iconPadding,
padding,
}: InlineBannerProps) {
const colorEnums = getColorEnums(bannerType)
const effectiveBannerType = bannerType || 'alert'
const colorEnums = getColorEnums(effectiveBannerType)

return (
<Wrapper
Expand All @@ -148,7 +149,7 @@ export function InlineBanner({
<span>
{!hideIcon && colorEnums.icon && (
<Icon
image={IconType.ALERT}
image={colorEnums.icon}
size={iconSize}
color={colorEnums.color}
description={bannerType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const MenuItem = ({
<styledEl.MenuItem isActive={isActive} onClick={onClick} isDropdownVisible={isDropdownVisible}>
<styledEl.Link to={routePath}>
<Trans>{item.label}</Trans>
{badgeText && (
{!isActive && badgeText && (
<styledEl.Badge type={badgeType}>
<Trans>{badgeText}</Trans>
</styledEl.Badge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Badge = styled.div<{ type?: BadgeType }>`
letter-spacing: 0.2px;
font-weight: 600;
transition: color 0.15s ease-in-out;
margin: -8px 0 0 0;
margin: 0;
a & {
color: ${({ type }) => badgeColors[type || 'default']};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function TwapSuggestionBanner({
parameterizeTradeRoute(tradeUrlParams, Routes.ADVANCED_ORDERS) + `?${TRADE_URL_SELL_AMOUNT_KEY}=${sellAmount}`

return (
<InlineBanner bannerType="alert">
<InlineBanner bannerType="alert" iconSize={32}>
<strong>Minimize price impact with TWAP</strong>
<p>
The price impact is <b>{+priceImpact.toFixed(2)}%</b>. Consider breaking up your order using a{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function UnsupportedWalletWarning({ isSafeViaWc }: { isSafeViaWc: boolean
}

return (
<InlineBanner bannerType="alert">
<InlineBanner bannerType="alert" iconSize={32}>
<strong>Unsupported wallet detected</strong>
<p>
TWAP orders currently require a Safe with a special fallback handler. Have one? Switch to it! Need setup?{' '}
Expand Down
14 changes: 9 additions & 5 deletions libs/tokens/src/pure/TokenLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ import { getTokenLogoUrls } from '../../utils/getTokenLogoUrls'

const invalidUrlsAtom = atom<{ [url: string]: boolean }>({})

const TokenLogoWrapper = styled.div`
const TokenLogoWrapper = styled.div<{ size?: number }>`
display: inline-block;
background: var(--cow-container-bg-01);
border-radius: 50%;
border-radius: ${({ size }) => size}px;
width: ${({ size }) => size}px;
height: ${({ size }) => size}px;
overflow: hidden;
img {
width: 100%;
height: 100%;
width: ${({ size }) => size}px;
height: ${({ size }) => size}px;
border-radius: ${({ size }) => size}px;
object-fit: contain;
}
`

Expand Down Expand Up @@ -57,7 +61,7 @@ export function TokenLogo({ logoURI, token, className, size = 36 }: TokenLogoPro
}

return (
<TokenLogoWrapper className={className} style={{ width: size, height: size }}>
<TokenLogoWrapper className={className} size={size}>
{!currentUrl ? <Slash size={size} /> : <img alt="" src={currentUrl} onError={onError} />}
</TokenLogoWrapper>
)
Expand Down
Loading