Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: modify empty text & style of favorite & pinboard #1977

Merged
merged 4 commits into from
Apr 17, 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { StyledPinboard } from '../styles';
export const EmptyItem = () => {
const { t } = useTranslation();
return (
<StyledPinboard disable={true} style={{ paddingLeft: '32px' }}>
{t('No item')}
<StyledPinboard disable={true} textWrap={true}>
{t('Organize pages to build knowledge')}
</StyledPinboard>
);
};
Expand Down
92 changes: 55 additions & 37 deletions apps/web/src/components/affine/pinboard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,62 @@ export const StyledPinboard = styled('div')<{
active?: boolean;
isOver?: boolean;
disableCollapse?: boolean;
}>(({ disableCollapse, disable = false, active = false, theme, isOver }) => {
return {
width: '100%',
height: '32px',
borderRadius: '8px',
...displayFlex('flex-start', 'center'),
padding: disableCollapse ? '0 5px' : '0 2px 0 16px',
position: 'relative',
color: disable
? theme.colors.disableColor
: active
? theme.colors.primaryColor
: theme.colors.textColor,
cursor: disable ? 'not-allowed' : 'pointer',
background: isOver ? alpha(theme.colors.primaryColor, 0.06) : '',
fontSize: theme.font.base,
userSelect: 'none',
span: {
flexGrow: '1',
textAlign: 'left',
...textEllipsis(1),
},
'.path-icon': {
fontSize: '16px',
transform: 'translateY(-4px)',
},
'.mode-icon': {
fontSize: '20px',
marginRight: '8px',
flexShrink: '0',
color: active ? theme.colors.primaryColor : theme.colors.iconColor,
},
textWrap?: boolean;
}>(
({
disableCollapse,
disable = false,
active = false,
theme,
isOver,
textWrap = false,
}) => {
return {
width: '100%',
lineHeight: '1.5',
minHeight: '32px',
borderRadius: '8px',
...displayFlex('flex-start', 'center'),
padding: disableCollapse ? '0 5px' : '0 2px 0 16px',
position: 'relative',
color: disable
? theme.colors.disableColor
: active
? theme.colors.primaryColor
: theme.colors.textColor,
cursor: disable ? 'not-allowed' : 'pointer',
background: isOver ? alpha(theme.colors.primaryColor, 0.06) : '',
fontSize: theme.font.base,
userSelect: 'none',
...(textWrap
? {
wordBreak: 'break-all',
whiteSpace: 'pre-wrap',
}
: {}),

':hover': {
backgroundColor: disable ? '' : theme.colors.hoverBackground,
},
};
});
span: {
flexGrow: '1',
textAlign: 'left',
...textEllipsis(1),
},
'.path-icon': {
fontSize: '16px',
transform: 'translateY(-4px)',
},
'.mode-icon': {
fontSize: '20px',
marginRight: '8px',
flexShrink: '0',
color: active ? theme.colors.primaryColor : theme.colors.iconColor,
},

':hover': {
backgroundColor: disable ? '' : theme.colors.hoverBackground,
},
};
}
);

export const StyledOperationButton = styled(IconButton, {
shouldForwardProp: prop => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { StyledCollapseItem } from '../shared-styles';

export const EmptyItem = () => {
const { t } = useTranslation();
return <StyledCollapseItem disable={true}>{t('No item')}</StyledCollapseItem>;
return (
<StyledCollapseItem disable={true} textWrap={true}>
{t('Favorite pages for easy access')}
</StyledCollapseItem>
);
};

export default EmptyItem;
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const FavoriteList = ({
) : (
<PageIcon />
)}
{pageMeta.title || 'Untitled'}
<span>{pageMeta.title || 'Untitled'}</span>
</StyledCollapseItem>
</div>
);
Expand Down
18 changes: 11 additions & 7 deletions apps/web/src/components/pure/workspace-slider-bar/shared-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ export const StyledCollapseItem = styled('div')<{
disable?: boolean;
active?: boolean;
isOver?: boolean;
}>(({ disable = false, active = false, theme, isOver }) => {
textWrap?: boolean;
}>(({ disable = false, active = false, theme, isOver, textWrap = false }) => {
return {
width: '100%',
height: '32px',
lineHeight: '1.5',
minHeight: '32px',
borderRadius: '8px',
...displayFlex('flex-start', 'center'),
padding: '0 2px 0 16px',
paddingRight: '2px',
position: 'relative',
color: disable
? theme.colors.disableColor
Expand All @@ -86,7 +88,12 @@ export const StyledCollapseItem = styled('div')<{
cursor: disable ? 'not-allowed' : 'pointer',
background: isOver ? alpha(theme.colors.primaryColor, 0.06) : '',
userSelect: 'none',

...(textWrap
? {
wordBreak: 'break-all',
whiteSpace: 'pre-wrap',
}
: {}),
span: {
flexGrow: '1',
textAlign: 'left',
Expand All @@ -98,9 +105,6 @@ export const StyledCollapseItem = styled('div')<{
flexShrink: '0',
color: active ? theme.colors.primaryColor : theme.colors.iconColor,
},
'.operation-button': {
visibility: 'hidden',
},

':hover': disable
? {}
Expand Down
2 changes: 2 additions & 0 deletions packages/i18n/src/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"Disable Public Link ?": "Disable Public Link ?",
"Disable Public Link Description": "Disabling this public link will prevent anyone with the link from accessing this page.",
"Export Shared Pages Description": "Download a static copy of your page to share with others.",
"Organize pages to build knowledge": "Organize pages to build knowledge",
"Favorite pages for easy access": "Favorite pages for easy access",
"Shared Pages Description": "Sharing page publicly requires AFFiNE Cloud service.",
"Create Shared Link Description": "Create a link you can easily share with anyone.",
"Shared Pages In Public Workspace Description": "The entire Workspace is published on the web and can be edited via <1>Workspace Settings</1>.",
Expand Down