mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-23 09:01:56 +03:00
icons: restores sub navigation for slates on navigation
This commit is contained in:
parent
ee45da8588
commit
2132af84ff
@ -46,7 +46,6 @@ const constructSlatesTreeForNavigation = (slates) => {
|
|||||||
name: s.slatename,
|
name: s.slatename,
|
||||||
pageTitle: `Viewing ${s.slatename}`,
|
pageTitle: `Viewing ${s.slatename}`,
|
||||||
decorator: "SLATE",
|
decorator: "SLATE",
|
||||||
ignore: true,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -71,9 +70,8 @@ export const generate = ({ library = [], slates = [] }) => [
|
|||||||
name: "Slates",
|
name: "Slates",
|
||||||
pageTitle: "Slates",
|
pageTitle: "Slates",
|
||||||
decorator: "SLATES",
|
decorator: "SLATES",
|
||||||
children: null,
|
children: constructSlatesTreeForNavigation(slates),
|
||||||
},
|
},
|
||||||
...constructSlatesTreeForNavigation(slates),
|
|
||||||
constructFilesTreeForNavigation(library),
|
constructFilesTreeForNavigation(library),
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
export const Layers = (props) => {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
height={props.height}
|
||||||
|
style={props.style}
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeWidth="1"
|
||||||
|
>
|
||||||
|
<path d="m22.917 6.2-10.209-5.278.00000004.00000002c-.444136-.229361-.971863-.229361-1.416-.0000001l-10.209 5.278-.00000007.00000003c-.3021.156451-.420172.528179-.263721.830279.058544.113046.150675.205177.263721.263721l10.209 5.281h.00000001c.444136.229361.971863.229361 1.416.00000005l10.209-5.275.00000002-.00000001c.3021-.156451.420172-.528179.263721-.830279-.058544-.113046-.150675-.205177-.263721-.263721z" />
|
||||||
|
<path d="m5.1 9.375-4.017 2.078-.00000007.00000003c-.3021.156451-.420172.528179-.263721.830279.058544.113046.150675.205177.263721.263721l10.209 5.281h.00000001c.444136.229361.971863.229361 1.416.00000005l10.209-5.281.00000002-.00000001c.3021-.156451.420172-.528179.263721-.830279-.058544-.113046-.150675-.205177-.263721-.263721l-4.017-2.078" />
|
||||||
|
<path d="m5.1 14.625-4.017 2.075-.00000007.00000003c-.3021.156451-.420172.528179-.263721.830279.058544.113046.150675.205177.263721.263721l10.209 5.281h.00000001c.444136.229361.971863.229361 1.416.00000005l10.209-5.275.00000002-.00000001c.3021-.156451.420172-.528179.263721-.830279-.058544-.113046-.150675-.205177-.263721-.263721l-4.017-2.081" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const SettingsDeveloper = (props) => {
|
export const SettingsDeveloper = (props) => {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
|
@ -23,7 +23,7 @@ const IconMap = {
|
|||||||
LOGS: <SVG.Logs height="20px" />,
|
LOGS: <SVG.Logs height="20px" />,
|
||||||
MINERS: <SVG.Miners height="20px" />,
|
MINERS: <SVG.Miners height="20px" />,
|
||||||
STORAGE_MARKET: <SVG.StorageMarket height="20px" />,
|
STORAGE_MARKET: <SVG.StorageMarket height="20px" />,
|
||||||
SLATES: <SVG.Slates height="20px" />,
|
SLATES: <SVG.Layers height="20px" />,
|
||||||
SLATE: <SVG.Slates height="20px" />,
|
SLATE: <SVG.Slates height="20px" />,
|
||||||
LOCAL_DATA: <SVG.HardDrive height="20px" />,
|
LOCAL_DATA: <SVG.HardDrive height="20px" />,
|
||||||
PROFILE_PAGE: <SVG.ProfileUser height="20px" />,
|
PROFILE_PAGE: <SVG.ProfileUser height="20px" />,
|
||||||
@ -152,17 +152,34 @@ const STYLES_ICON_ELEMENT = css`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Item = ({ data, id, activeIds, level, children, showActive, decorator, onToggleShow, onNavigateTo }) => {
|
const Item = ({
|
||||||
|
data,
|
||||||
|
id,
|
||||||
|
activeIds,
|
||||||
|
level,
|
||||||
|
children,
|
||||||
|
showActive,
|
||||||
|
decorator,
|
||||||
|
onToggleShow,
|
||||||
|
onNavigateTo,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<span css={STYLES_NAVIGATION_ITEM} style={{ padding: `0 0 0 ${level * 16}px` }}>
|
<span
|
||||||
|
css={STYLES_NAVIGATION_ITEM}
|
||||||
|
style={{ padding: `0 0 0 ${level * 16}px` }}
|
||||||
|
>
|
||||||
<span css={STYLES_EXPANDER} onClick={onToggleShow ? onToggleShow : null}>
|
<span css={STYLES_EXPANDER} onClick={onToggleShow ? onToggleShow : null}>
|
||||||
<span
|
<span
|
||||||
css={STYLES_ICON_ELEMENT}
|
css={STYLES_ICON_ELEMENT}
|
||||||
style={{
|
style={{
|
||||||
color: activeIds[id] ? Constants.system.brand : null,
|
color: activeIds[id] ? Constants.system.brand : null,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{onToggleShow ? (
|
{onToggleShow ? (
|
||||||
<SVG.ExpandArrow height="8px" style={showActive ? { transform: `rotate(90deg)` } : null} />
|
<SVG.ExpandArrow
|
||||||
|
height="8px"
|
||||||
|
style={showActive ? { transform: `rotate(90deg)` } : null}
|
||||||
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -171,7 +188,8 @@ const Item = ({ data, id, activeIds, level, children, showActive, decorator, onT
|
|||||||
css={STYLES_ICON_ELEMENT}
|
css={STYLES_ICON_ELEMENT}
|
||||||
style={{
|
style={{
|
||||||
color: activeIds[id] ? Constants.system.brand : null,
|
color: activeIds[id] ? Constants.system.brand : null,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{IconMap[decorator]}
|
{IconMap[decorator]}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -180,7 +198,8 @@ const Item = ({ data, id, activeIds, level, children, showActive, decorator, onT
|
|||||||
onClick={() => onNavigateTo({ id }, data)}
|
onClick={() => onNavigateTo({ id }, data)}
|
||||||
style={{
|
style={{
|
||||||
color: activeIds[id] ? Constants.system.brand : null,
|
color: activeIds[id] ? Constants.system.brand : null,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -197,7 +216,17 @@ class NodeReference extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { id, activeId, activeIds, level, children, treeChildren, decorator, onNavigateTo, data } = this.props;
|
const {
|
||||||
|
id,
|
||||||
|
activeId,
|
||||||
|
activeIds,
|
||||||
|
level,
|
||||||
|
children,
|
||||||
|
treeChildren,
|
||||||
|
decorator,
|
||||||
|
onNavigateTo,
|
||||||
|
data,
|
||||||
|
} = this.props;
|
||||||
const { showTreeChildren } = this.state;
|
const { showTreeChildren } = this.state;
|
||||||
|
|
||||||
let showActive = showTreeChildren || activeIds[id];
|
let showActive = showTreeChildren || activeIds[id];
|
||||||
@ -215,7 +244,10 @@ class NodeReference extends React.Component {
|
|||||||
treeChildren={treeChildren}
|
treeChildren={treeChildren}
|
||||||
onNavigateTo={onNavigateTo}
|
onNavigateTo={onNavigateTo}
|
||||||
decorator={decorator}
|
decorator={decorator}
|
||||||
onToggleShow={treeChildren && treeChildren.length ? this._handleToggleShow : null}>
|
onToggleShow={
|
||||||
|
treeChildren && treeChildren.length ? this._handleToggleShow : null
|
||||||
|
}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
@ -239,7 +271,8 @@ class NodeReference extends React.Component {
|
|||||||
onNavigateTo={onNavigateTo}
|
onNavigateTo={onNavigateTo}
|
||||||
level={level + 1}
|
level={level + 1}
|
||||||
treeChildren={child.children}
|
treeChildren={child.children}
|
||||||
decorator={child.decorator}>
|
decorator={child.decorator}
|
||||||
|
>
|
||||||
{child.name}
|
{child.name}
|
||||||
</NodeReference>
|
</NodeReference>
|
||||||
);
|
);
|
||||||
@ -275,7 +308,12 @@ export default class ApplicationNavigation extends React.Component {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<a css={STYLES_PROFILE} style={{ marginLeft: 16 }} href={`/${this.props.viewer.username}`} target="_blank">
|
<a
|
||||||
|
css={STYLES_PROFILE}
|
||||||
|
style={{ marginLeft: 16 }}
|
||||||
|
href={`/${this.props.viewer.username}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
css={STYLES_PROFILE_IMAGE}
|
css={STYLES_PROFILE_IMAGE}
|
||||||
style={{
|
style={{
|
||||||
@ -304,7 +342,8 @@ export default class ApplicationNavigation extends React.Component {
|
|||||||
onNavigateTo={this.props.onNavigateTo}
|
onNavigateTo={this.props.onNavigateTo}
|
||||||
level={0}
|
level={0}
|
||||||
treeChildren={each.children}
|
treeChildren={each.children}
|
||||||
decorator={each.decorator}>
|
decorator={each.decorator}
|
||||||
|
>
|
||||||
{each.name}
|
{each.name}
|
||||||
</NodeReference>
|
</NodeReference>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user