一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
148 行
4.0 KiB
TypeScript
148 行
4.0 KiB
TypeScript
import shim from '@joplin/lib/shim';
|
|
import Button from '../../Button/Button';
|
|
import styled, { css } from 'styled-components';
|
|
|
|
interface StyleProps {
|
|
theme: {
|
|
backgroundColor2: string;
|
|
backgroundColor: string;
|
|
backgroundColorHover2: string;
|
|
color2: string;
|
|
color4: string;
|
|
colorError2: string;
|
|
colorFaded2: string;
|
|
colorPublished2: string;
|
|
colorWarn2: string;
|
|
topRowHeight: number;
|
|
mainPadding: number;
|
|
fontSize: number;
|
|
toolbarIconSize: number;
|
|
};
|
|
isConflictFolder?: boolean;
|
|
isSpecialItem?: boolean;
|
|
isPublished?: boolean;
|
|
shareId?: string;
|
|
selected?: boolean;
|
|
}
|
|
|
|
export const StyledRoot = styled.div`
|
|
background-color: ${(props: StyleProps) => props.theme.backgroundColor2};
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow-x: hidden;
|
|
overflow-y: hidden;
|
|
display: inline-flex;
|
|
flex-direction: column;
|
|
`;
|
|
|
|
export const StyledHeader = styled.div`
|
|
//height: ${(props: StyleProps) => props.theme.topRowHeight}px;
|
|
//text-decoration: none;
|
|
flex: 1;
|
|
box-sizing: border-box;
|
|
padding: ${(props: StyleProps) => props.theme.mainPadding}px;
|
|
padding-bottom: ${(props: StyleProps) => props.theme.mainPadding / 2}px;
|
|
display: flex;
|
|
align-items: center;
|
|
user-select: none;
|
|
text-transform: uppercase;
|
|
//cursor: pointer;
|
|
cursor: default;
|
|
transition: background 0.2s;
|
|
&:hover {
|
|
background: ${(props: StyleProps) => props.theme.backgroundColorHover2};
|
|
}
|
|
`;
|
|
|
|
export const StyledHeaderIcon = styled.i`
|
|
font-size: ${(props: StyleProps) => props.theme.toolbarIconSize}px;
|
|
color: ${(props: StyleProps) => props.theme.color2};
|
|
margin-right: 8px;
|
|
`;
|
|
|
|
export const StyledAllNotesIcon = styled(StyledHeaderIcon)`
|
|
font-size: ${(props: StyleProps) => props.theme.toolbarIconSize * 0.8}px;
|
|
color: ${(props: StyleProps) => props.theme.colorFaded2};
|
|
margin-right: 8px;
|
|
`;
|
|
|
|
export const StyledHeaderLabel = styled.span`
|
|
flex: 1;
|
|
color: ${(props: StyleProps) => props.theme.color2};
|
|
font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.1)}px;
|
|
font-weight: bold;
|
|
`;
|
|
|
|
function listItemTextColor(props: StyleProps) {
|
|
if (props.isConflictFolder) return props.theme.colorError2;
|
|
if (props.isSpecialItem) return props.theme.colorFaded2;
|
|
if (props.selected && props.isPublished) return props.theme.color2;
|
|
if (props.isPublished) return props.theme.colorPublished2;
|
|
if (props.shareId) return props.theme.colorWarn2;
|
|
return props.theme.color2;
|
|
}
|
|
|
|
export const StyledListItemAnchor = styled.a`
|
|
font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.0833333)}px;
|
|
text-decoration: none;
|
|
color: ${(props: StyleProps) => listItemTextColor(props)};
|
|
cursor: default;
|
|
opacity: ${(props: StyleProps) => {
|
|
// So that the conflicts folder and shared folders have sufficient contrast,
|
|
// use an opacity of 1 even when unselected.
|
|
const needsHigherContrast = props.isConflictFolder || props.isSpecialItem;
|
|
return (props.selected || props.shareId || props.isPublished || needsHigherContrast) ? 1 : 0.8;
|
|
}};
|
|
white-space: nowrap;
|
|
display: flex;
|
|
flex: 1;
|
|
align-items: center;
|
|
user-select: none;
|
|
height: 100%;
|
|
|
|
/* A different background color is already used to indicate focus for sidebar list items. */
|
|
&:focus-visible {
|
|
outline: none;
|
|
}
|
|
`;
|
|
|
|
export const StyledShareIcon = styled.i`
|
|
margin-left: 8px;
|
|
`;
|
|
|
|
export const StyledSynchronizeButton = styled(Button)`
|
|
width: 100%;
|
|
`;
|
|
|
|
export const StyledAddButton = styled(Button)`
|
|
border: none;
|
|
padding-right: 15px;
|
|
padding-top: 4px;
|
|
`;
|
|
|
|
export const StyledSyncReport = styled.div`
|
|
font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 0.9)}px;
|
|
color: ${(props: StyleProps) => props.theme.color2};
|
|
opacity: 0.5;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-left: 5px;
|
|
margin-right: 5px;
|
|
margin-bottom: 10px;
|
|
word-wrap: break-word;
|
|
`;
|
|
|
|
export const StyledSyncReportText = styled.div`
|
|
color: ${(props: StyleProps) => props.theme.color2};
|
|
word-wrap: break-word;
|
|
width: 100%;
|
|
`;
|
|
|
|
// Workaround sidebar rendering bug on Linux Intel GPU.
|
|
// https://github.com/laurent22/joplin/issues/7506
|
|
export const StyledSpanFix = styled.span`
|
|
${shim.isLinux() && css`
|
|
position: relative;
|
|
`}
|
|
`;
|