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

🐛 (mobile) fix sync button design #1665

Merged
merged 2 commits into from
Sep 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
48 changes: 21 additions & 27 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import React, {
import { useSelector } from 'react-redux';
import { Routes, Route, useLocation, useNavigate } from 'react-router-dom';

import { css, media } from 'glamor';

import * as Platform from 'loot-core/src/client/platform';
import * as queries from 'loot-core/src/client/queries';
import { listen } from 'loot-core/src/platform/client/fetch';
Expand All @@ -24,7 +22,6 @@ import SvgEyeSlashed from '../icons/v2/EyeSlashed';
import NavigationMenu from '../icons/v2/NavigationMenu';
import { useResponsive } from '../ResponsiveProvider';
import { colors, type CSSProperties } from '../style';
import tokens from '../tokens';

import AccountSyncCheck from './accounts/AccountSyncCheck';
import AnimatedRefresh from './AnimatedRefresh';
Expand Down Expand Up @@ -107,8 +104,9 @@ function PrivacyButton() {

type SyncButtonProps = {
style?: CSSProperties;
isMobile?: boolean;
};
export function SyncButton({ style }: SyncButtonProps) {
export function SyncButton({ style, isMobile = false }: SyncButtonProps) {
let cloudFileId = useSelector(state => state.prefs.local.cloudFileId);
let { sync } = useActions();

Expand Down Expand Up @@ -156,33 +154,29 @@ export function SyncButton({ style }: SyncButtonProps) {
syncState === 'local'
? colors.n9
: style.color;
const activeStyle = css(
// mobile
media(`(max-width: ${tokens.breakpoint_small})`, {
color: mobileColor,
}),
);
const desktopColor =
syncState === 'error'
? colors.r4
: syncState === 'disabled' ||
syncState === 'offline' ||
syncState === 'local'
? colors.n6
: null;

const activeStyle = isMobile
? {
color: mobileColor,
}
: {};

return (
<Button
type="bare"
style={css(
style,
{
WebkitAppRegion: 'none',
color: mobileColor,
},
media(`(min-width: ${tokens.breakpoint_small})`, {
color:
syncState === 'error'
? colors.r4
: syncState === 'disabled' ||
syncState === 'offline' ||
syncState === 'local'
? colors.n6
: null,
}),
)}
style={{
...style,
WebkitAppRegion: 'none',
color: isMobile ? mobileColor : desktopColor,
}}
hoveredStyle={activeStyle}
activeStyle={activeStyle}
onClick={sync}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ function BudgetHeader({

{serverURL && (
<SyncButton
isMobile
style={{
color: 'white',
position: 'absolute',
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1665.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

Mobile: fix sync button design