Improved sidebar selected styling, simplified logic and css
This commit is contained in:
@@ -7,8 +7,9 @@ import { HomeIcon, EditIcon, SearchIcon, StarredIcon } from 'outline-icons';
|
|||||||
|
|
||||||
import Flex from 'shared/components/Flex';
|
import Flex from 'shared/components/Flex';
|
||||||
import AccountMenu from 'menus/AccountMenu';
|
import AccountMenu from 'menus/AccountMenu';
|
||||||
import Sidebar, { Section } from './Sidebar';
|
import Sidebar from './Sidebar';
|
||||||
import Scrollable from 'components/Scrollable';
|
import Scrollable from 'components/Scrollable';
|
||||||
|
import Section from './components/Section';
|
||||||
import Collections from './components/Collections';
|
import Collections from './components/Collections';
|
||||||
import SidebarLink from './components/SidebarLink';
|
import SidebarLink from './components/SidebarLink';
|
||||||
import HeaderBlock from './components/HeaderBlock';
|
import HeaderBlock from './components/HeaderBlock';
|
||||||
@@ -56,24 +57,31 @@ class MainSidebar extends React.Component<Props> {
|
|||||||
<Flex auto column>
|
<Flex auto column>
|
||||||
<Scrollable shadow>
|
<Scrollable shadow>
|
||||||
<Section>
|
<Section>
|
||||||
<SidebarLink to="/dashboard" icon={<HomeIcon />} exact={false}>
|
<SidebarLink
|
||||||
Home
|
to="/dashboard"
|
||||||
</SidebarLink>
|
icon={<HomeIcon />}
|
||||||
<SidebarLink to="/search" icon={<SearchIcon />}>
|
exact={false}
|
||||||
Search
|
label="Home"
|
||||||
</SidebarLink>
|
/>
|
||||||
<SidebarLink to="/starred" icon={<StarredIcon />} exact={false}>
|
<SidebarLink to="/search" icon={<SearchIcon />} label="Search" />
|
||||||
Starred
|
<SidebarLink
|
||||||
</SidebarLink>
|
to="/starred"
|
||||||
|
icon={<StarredIcon />}
|
||||||
|
exact={false}
|
||||||
|
label="Starred"
|
||||||
|
/>
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to="/drafts"
|
to="/drafts"
|
||||||
icon={<EditIcon />}
|
icon={<EditIcon />}
|
||||||
active={
|
active={
|
||||||
documents.active ? !documents.active.publishedAt : undefined
|
documents.active ? !documents.active.publishedAt : undefined
|
||||||
}
|
}
|
||||||
>
|
label={
|
||||||
Drafts <Bubble count={documents.drafts.length} />
|
<React.Fragment>
|
||||||
</SidebarLink>
|
Drafts <Bubble count={documents.drafts.length} />
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section>
|
<Section>
|
||||||
<Collections
|
<Collections
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ import ZapierIcon from './icons/Zapier';
|
|||||||
import SlackIcon from './icons/Slack';
|
import SlackIcon from './icons/Slack';
|
||||||
|
|
||||||
import Flex from 'shared/components/Flex';
|
import Flex from 'shared/components/Flex';
|
||||||
import Sidebar, { Section } from './Sidebar';
|
import Sidebar from './Sidebar';
|
||||||
import Scrollable from 'components/Scrollable';
|
import Scrollable from 'components/Scrollable';
|
||||||
|
import Section from './components/Section';
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
import SidebarLink from './components/SidebarLink';
|
import SidebarLink from './components/SidebarLink';
|
||||||
import HeaderBlock from './components/HeaderBlock';
|
import HeaderBlock from './components/HeaderBlock';
|
||||||
@@ -50,42 +51,55 @@ class SettingsSidebar extends React.Component<Props> {
|
|||||||
<Scrollable shadow>
|
<Scrollable shadow>
|
||||||
<Section>
|
<Section>
|
||||||
<Header>Account</Header>
|
<Header>Account</Header>
|
||||||
<SidebarLink to="/settings" icon={<ProfileIcon />}>
|
<SidebarLink
|
||||||
Profile
|
to="/settings"
|
||||||
</SidebarLink>
|
icon={<ProfileIcon />}
|
||||||
<SidebarLink to="/settings/notifications" icon={<EmailIcon />}>
|
label="Profile"
|
||||||
Notifications
|
/>
|
||||||
</SidebarLink>
|
<SidebarLink
|
||||||
<SidebarLink to="/settings/tokens" icon={<CodeIcon />}>
|
to="/settings/notifications"
|
||||||
API Tokens
|
icon={<EmailIcon />}
|
||||||
</SidebarLink>
|
label="Notifications"
|
||||||
|
/>
|
||||||
|
<SidebarLink
|
||||||
|
to="/settings/tokens"
|
||||||
|
icon={<CodeIcon />}
|
||||||
|
label="API Tokens"
|
||||||
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section>
|
<Section>
|
||||||
<Header>Team</Header>
|
<Header>Team</Header>
|
||||||
{user.isAdmin && (
|
{user.isAdmin && (
|
||||||
<SidebarLink to="/settings/details" icon={<TeamIcon />}>
|
<SidebarLink
|
||||||
Details
|
to="/settings/details"
|
||||||
</SidebarLink>
|
icon={<TeamIcon />}
|
||||||
|
label="Details"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{user.isAdmin && (
|
{user.isAdmin && (
|
||||||
<SidebarLink to="/settings/security" icon={<PadlockIcon />}>
|
<SidebarLink
|
||||||
Security
|
to="/settings/security"
|
||||||
</SidebarLink>
|
icon={<PadlockIcon />}
|
||||||
|
label="Security"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to="/settings/people"
|
to="/settings/people"
|
||||||
icon={<UserIcon />}
|
icon={<UserIcon />}
|
||||||
exact={false}
|
exact={false}
|
||||||
>
|
label="People"
|
||||||
People
|
/>
|
||||||
</SidebarLink>
|
<SidebarLink
|
||||||
<SidebarLink to="/settings/shares" icon={<LinkIcon />}>
|
to="/settings/shares"
|
||||||
Share Links
|
icon={<LinkIcon />}
|
||||||
</SidebarLink>
|
label="Share Links"
|
||||||
|
/>
|
||||||
{user.isAdmin && (
|
{user.isAdmin && (
|
||||||
<SidebarLink to="/settings/export" icon={<DocumentIcon />}>
|
<SidebarLink
|
||||||
Export Data
|
to="/settings/export"
|
||||||
</SidebarLink>
|
icon={<DocumentIcon />}
|
||||||
|
label="Export Data"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Section>
|
</Section>
|
||||||
{user.isAdmin && (
|
{user.isAdmin && (
|
||||||
@@ -94,15 +108,13 @@ class SettingsSidebar extends React.Component<Props> {
|
|||||||
<SidebarLink
|
<SidebarLink
|
||||||
to="/settings/integrations/slack"
|
to="/settings/integrations/slack"
|
||||||
icon={<SlackIcon />}
|
icon={<SlackIcon />}
|
||||||
>
|
label="Slack"
|
||||||
Slack
|
/>
|
||||||
</SidebarLink>
|
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to="/settings/integrations/zapier"
|
to="/settings/integrations/zapier"
|
||||||
icon={<ZapierIcon />}
|
icon={<ZapierIcon />}
|
||||||
>
|
label="Zapier"
|
||||||
Zapier
|
/>
|
||||||
</SidebarLink>
|
|
||||||
</Section>
|
</Section>
|
||||||
)}
|
)}
|
||||||
</Scrollable>
|
</Scrollable>
|
||||||
|
|||||||
@@ -88,13 +88,6 @@ const Container = styled(Flex)`
|
|||||||
`};
|
`};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Section = styled(Flex)`
|
|
||||||
flex-direction: column;
|
|
||||||
margin: 24px 0;
|
|
||||||
padding: 0 24px;
|
|
||||||
position: relative;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Toggle = styled.a`
|
const Toggle = styled.a`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ const Wrapper = styled.div`
|
|||||||
color: ${props => props.theme.white};
|
color: ${props => props.theme.white};
|
||||||
background: ${props => props.theme.slateDark};
|
background: ${props => props.theme.slateDark};
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-width: 15px;
|
font-feature-settings: "tnum";
|
||||||
padding: 0 5px;
|
font-weight: 500;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
min-width: 15px;
|
||||||
|
padding: 0 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
left: 2px;
|
left: 2px;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import * as React from 'react';
|
|||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { observable } from 'mobx';
|
import { observable } from 'mobx';
|
||||||
import { CollectionIcon, PrivateCollectionIcon } from 'outline-icons';
|
import { CollectionIcon, PrivateCollectionIcon } from 'outline-icons';
|
||||||
import styled from 'styled-components';
|
|
||||||
import Collection from 'models/Collection';
|
import Collection from 'models/Collection';
|
||||||
import Document from 'models/Document';
|
import Document from 'models/Document';
|
||||||
import CollectionMenu from 'menus/CollectionMenu';
|
import CollectionMenu from 'menus/CollectionMenu';
|
||||||
@@ -56,23 +55,10 @@ class CollectionLink extends React.Component<Props> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
iconColor={collection.color}
|
iconColor={collection.color}
|
||||||
expand={expanded}
|
expanded={expanded}
|
||||||
hideExpandToggle
|
hideDisclosure
|
||||||
menuOpen={this.menuOpen}
|
menuOpen={this.menuOpen}
|
||||||
expandedContent={
|
label={collection.name}
|
||||||
<CollectionChildren column>
|
|
||||||
{collection.documents.map(document => (
|
|
||||||
<DocumentLink
|
|
||||||
key={document.id}
|
|
||||||
history={history}
|
|
||||||
document={document}
|
|
||||||
activeDocument={activeDocument}
|
|
||||||
prefetchDocument={prefetchDocument}
|
|
||||||
depth={0}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</CollectionChildren>
|
|
||||||
}
|
|
||||||
menu={
|
menu={
|
||||||
<CollectionMenu
|
<CollectionMenu
|
||||||
history={history}
|
history={history}
|
||||||
@@ -82,23 +68,22 @@ class CollectionLink extends React.Component<Props> {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<CollectionName justify="space-between">
|
<Flex column>
|
||||||
{collection.name}
|
{collection.documents.map(document => (
|
||||||
</CollectionName>
|
<DocumentLink
|
||||||
|
key={document.id}
|
||||||
|
history={history}
|
||||||
|
document={document}
|
||||||
|
activeDocument={activeDocument}
|
||||||
|
prefetchDocument={prefetchDocument}
|
||||||
|
depth={1.5}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
</SidebarLink>
|
</SidebarLink>
|
||||||
</DropToImport>
|
</DropToImport>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CollectionName = styled(Flex)`
|
|
||||||
padding: 0 0 4px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CollectionChildren = styled(Flex)`
|
|
||||||
margin-top: -4px;
|
|
||||||
margin-left: 36px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default CollectionLink;
|
export default CollectionLink;
|
||||||
|
|||||||
@@ -50,9 +50,8 @@ class Collections extends React.Component<Props> {
|
|||||||
<SidebarLink
|
<SidebarLink
|
||||||
onClick={this.props.onCreateCollection}
|
onClick={this.props.onCreateCollection}
|
||||||
icon={<PlusIcon />}
|
icon={<PlusIcon />}
|
||||||
>
|
label="New collection…"
|
||||||
New collection…
|
/>
|
||||||
</SidebarLink>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class DocumentLink extends React.Component<Props> {
|
|||||||
.includes(document.id) ||
|
.includes(document.id) ||
|
||||||
isActiveDocument)
|
isActiveDocument)
|
||||||
);
|
);
|
||||||
|
const hasChildren = !!document.children.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@@ -64,27 +65,24 @@ class DocumentLink extends React.Component<Props> {
|
|||||||
pathname: document.url,
|
pathname: document.url,
|
||||||
state: { title: document.title },
|
state: { title: document.title },
|
||||||
}}
|
}}
|
||||||
expand={showChildren}
|
expanded={showChildren}
|
||||||
expandedContent={
|
label={document.title}
|
||||||
document.children.length ? (
|
depth={depth}
|
||||||
<DocumentChildren column>
|
|
||||||
{document.children.map(childDocument => (
|
|
||||||
<DocumentLink
|
|
||||||
key={childDocument.id}
|
|
||||||
history={history}
|
|
||||||
document={childDocument}
|
|
||||||
activeDocument={activeDocument}
|
|
||||||
prefetchDocument={prefetchDocument}
|
|
||||||
depth={depth + 1}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</DocumentChildren>
|
|
||||||
) : (
|
|
||||||
undefined
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{document.title}
|
{hasChildren && (
|
||||||
|
<DocumentChildren column>
|
||||||
|
{document.children.map(childDocument => (
|
||||||
|
<DocumentLink
|
||||||
|
key={childDocument.id}
|
||||||
|
history={history}
|
||||||
|
document={childDocument}
|
||||||
|
activeDocument={activeDocument}
|
||||||
|
prefetchDocument={prefetchDocument}
|
||||||
|
depth={depth + 1}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</DocumentChildren>
|
||||||
|
)}
|
||||||
</SidebarLink>
|
</SidebarLink>
|
||||||
</DropToImport>
|
</DropToImport>
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -92,9 +90,6 @@ class DocumentLink extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DocumentChildren = styled(Flex)`
|
const DocumentChildren = styled(Flex)``;
|
||||||
margin-top: -4px;
|
|
||||||
margin-left: 12px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default DocumentLink;
|
export default DocumentLink;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const Header = styled(Flex)`
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: ${props => props.theme.slateDark};
|
color: ${props => props.theme.slateDark};
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
margin-bottom: 4px;
|
margin: 4px 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default Header;
|
export default Header;
|
||||||
|
|||||||
11
app/components/Sidebar/components/Section.js
Normal file
11
app/components/Sidebar/components/Section.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// @flow
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import Flex from 'shared/components/Flex';
|
||||||
|
|
||||||
|
const Section = styled(Flex)`
|
||||||
|
position: relative;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 24px 8px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Section;
|
||||||
@@ -7,78 +7,52 @@ import { CollapsedIcon } from 'outline-icons';
|
|||||||
import styled, { withTheme } from 'styled-components';
|
import styled, { withTheme } from 'styled-components';
|
||||||
import Flex from 'shared/components/Flex';
|
import Flex from 'shared/components/Flex';
|
||||||
|
|
||||||
const StyledGoTo = styled(CollapsedIcon)`
|
|
||||||
margin-bottom: -4px;
|
|
||||||
margin-left: 1px;
|
|
||||||
margin-right: -3px;
|
|
||||||
${({ expanded }) => !expanded && 'transform: rotate(-90deg);'};
|
|
||||||
`;
|
|
||||||
|
|
||||||
const IconWrapper = styled.span`
|
|
||||||
margin-left: -4px;
|
|
||||||
margin-right: 4px;
|
|
||||||
height: 24px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StyledNavLink = styled(NavLink)`
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
padding: 4px 0;
|
|
||||||
margin-left: ${props => (props.icon ? '-20px;' : '0')};
|
|
||||||
color: ${props => props.theme.slateDark};
|
|
||||||
font-size: 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: ${props => props.theme.text};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
to?: string | Object,
|
to?: string | Object,
|
||||||
onClick?: (SyntheticEvent<*>) => *,
|
onClick?: (SyntheticEvent<*>) => *,
|
||||||
children?: React.Node,
|
children?: React.Node,
|
||||||
icon?: React.Node,
|
icon?: React.Node,
|
||||||
expand?: boolean,
|
expanded?: boolean,
|
||||||
expandedContent?: React.Node,
|
label?: React.Node,
|
||||||
menu?: React.Node,
|
menu?: React.Node,
|
||||||
menuOpen?: boolean,
|
menuOpen?: boolean,
|
||||||
hideExpandToggle?: boolean,
|
hideDisclosure?: boolean,
|
||||||
iconColor?: string,
|
iconColor?: string,
|
||||||
active?: boolean,
|
active?: boolean,
|
||||||
theme: Object,
|
theme: Object,
|
||||||
exact?: boolean,
|
exact?: boolean,
|
||||||
|
depth?: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class SidebarLink extends React.Component<Props> {
|
class SidebarLink extends React.Component<Props> {
|
||||||
@observable expanded: boolean = false;
|
@observable expanded: boolean;
|
||||||
activeStyle: Object;
|
|
||||||
|
|
||||||
constructor(props) {
|
style = {
|
||||||
super(props);
|
paddingLeft: `${(this.props.depth || 0) * 16 + 16}px`,
|
||||||
|
};
|
||||||
|
|
||||||
this.activeStyle = {
|
activeStyle = {
|
||||||
color: props.theme.black,
|
color: this.props.theme.text,
|
||||||
fontWeight: 500,
|
background: 'rgba(0, 0, 0, 0.05)',
|
||||||
};
|
fontWeight: 600,
|
||||||
}
|
...this.style,
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.props.expand) this.handleExpand();
|
if (this.props.expanded) this.handleExpand();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: Props) {
|
componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.expand) this.handleExpand();
|
if (nextProps.expanded !== undefined) {
|
||||||
|
this.expanded = nextProps.expanded;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
handleClick = (event: SyntheticEvent<*>) => {
|
handleClick = (ev: SyntheticEvent<*>) => {
|
||||||
event.preventDefault();
|
ev.preventDefault();
|
||||||
event.stopPropagation();
|
ev.stopPropagation();
|
||||||
this.expanded = !this.expanded;
|
this.expanded = !this.expanded;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -93,47 +67,69 @@ class SidebarLink extends React.Component<Props> {
|
|||||||
children,
|
children,
|
||||||
onClick,
|
onClick,
|
||||||
to,
|
to,
|
||||||
expandedContent,
|
label,
|
||||||
expand,
|
|
||||||
active,
|
active,
|
||||||
menu,
|
menu,
|
||||||
menuOpen,
|
menuOpen,
|
||||||
hideExpandToggle,
|
hideDisclosure,
|
||||||
exact,
|
exact,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const showExpandIcon =
|
const showDisclosure = !!children && !hideDisclosure;
|
||||||
expandedContent && !hideExpandToggle ? true : undefined;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper menuOpen={menuOpen} column>
|
<Wrapper menuOpen={menuOpen} column>
|
||||||
<StyledNavLink
|
<StyledNavLink
|
||||||
icon={showExpandIcon}
|
|
||||||
activeStyle={this.activeStyle}
|
activeStyle={this.activeStyle}
|
||||||
style={active ? this.activeStyle : undefined}
|
style={active ? this.activeStyle : this.style}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
exact={exact !== false}
|
exact={exact !== false}
|
||||||
to={to}
|
to={to}
|
||||||
as={to ? undefined : 'div'}
|
as={to ? undefined : 'div'}
|
||||||
>
|
>
|
||||||
{icon && <IconWrapper>{icon}</IconWrapper>}
|
{icon && <IconWrapper>{icon}</IconWrapper>}
|
||||||
{showExpandIcon && (
|
<Label onClick={this.handleExpand}>
|
||||||
<StyledGoTo expanded={this.expanded} onClick={this.handleClick} />
|
{showDisclosure && (
|
||||||
)}
|
<Disclosure expanded={this.expanded} onClick={this.handleClick} />
|
||||||
<Content onClick={this.handleExpand}>{children}</Content>
|
)}
|
||||||
|
{label}
|
||||||
|
</Label>
|
||||||
</StyledNavLink>
|
</StyledNavLink>
|
||||||
{/* Collection */ expand && hideExpandToggle && expandedContent}
|
{this.expanded && children}
|
||||||
{/* Document */ this.expanded && !hideExpandToggle && expandedContent}
|
|
||||||
{menu && <Action>{menu}</Action>}
|
{menu && <Action>{menu}</Action>}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// accounts for whitespace around icon
|
||||||
|
const IconWrapper = styled.span`
|
||||||
|
margin-left: -4px;
|
||||||
|
margin-right: 4px;
|
||||||
|
height: 24px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledNavLink = styled(NavLink)`
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
padding: 4px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: ${props => props.theme.slateDark};
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: ${props => props.theme.text};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const Action = styled.span`
|
const Action = styled.span`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
top: 4px;
|
||||||
top: 2px;
|
right: 4px;
|
||||||
color: ${props => props.theme.slate};
|
color: ${props => props.theme.slate};
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
@@ -159,9 +155,17 @@ const Wrapper = styled(Flex)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Content = styled.div`
|
const Label = styled.div`
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 4em;
|
max-height: 4.4em;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Disclosure = styled(CollapsedIcon)`
|
||||||
|
position: absolute;
|
||||||
|
left: -24px;
|
||||||
|
|
||||||
|
${({ expanded }) => !expanded && 'transform: rotate(-90deg);'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default withRouter(withTheme(SidebarLink));
|
export default withRouter(withTheme(SidebarLink));
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ const Breadcrumb = observer(({ document, collections }: Props) => {
|
|||||||
</CollectionName>
|
</CollectionName>
|
||||||
{path.map(n => (
|
{path.map(n => (
|
||||||
<React.Fragment key={n.id}>
|
<React.Fragment key={n.id}>
|
||||||
<Slash /> <Crumb to={n.url}>{n.title}</Crumb>
|
<Slash />{' '}
|
||||||
|
<Crumb to={n.url} title={n.title}>
|
||||||
|
{n.title}
|
||||||
|
</Crumb>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user