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

refactor: use SVG icon for home breadcrumb #7183

Merged
merged 5 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions packages/docusaurus-theme-classic/src/theme-classic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,14 @@ declare module '@theme/IconEdit' {
export default function IconEdit(props: Props): JSX.Element;
}

declare module '@theme/IconHome' {
import type {ComponentProps} from 'react';

export interface Props extends ComponentProps<'svg'> {}

export default function IconHome(props: Props): JSX.Element;
}

declare module '@theme/IconLightMode' {
import type {ComponentProps} from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import styles from './styles.module.css';
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import IconHome from '@theme/IconHome';

// TODO move to design system folder
function BreadcrumbsItemLink({
Expand Down Expand Up @@ -76,7 +77,7 @@ function HomeBreadcrumbItem() {
<Link
className={clsx('breadcrumbs__link', styles.breadcrumbsItemLink)}
href={homeHref}>
🏠
<IconHome className={styles.icon} />
</Link>
</li>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@
--ifm-breadcrumb-size-multiplier: 0.8;
margin-bottom: 0.8rem;
}

.icon {
vertical-align: middle;
height: 1rem;
width: 1rem;
}
20 changes: 20 additions & 0 deletions packages/docusaurus-theme-classic/src/theme/IconHome/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import type {Props} from '@theme/IconHome';

export default function IconDarkMode(props: Props): JSX.Element {
return (
<svg viewBox="0 0 24 24" width={24} height={24} {...props}>
<path
fill="currentColor"
d="M 23.175781 10.5 L 21 8.328125 L 21 3 C 21 2.175781 20.324219 1.5 19.5 1.5 L 18 1.5 C 17.175781 1.5 16.5 2.175781 16.5 3 L 16.5 3.828125 L 13.5 0.832031 C 13.089844 0.445312 12.714844 0 12 0 C 11.285156 0 10.910156 0.445312 10.5 0.832031 L 0.824219 10.5 C 0.355469 10.988281 0 11.34375 0 12 C 0 12.84375 0.648438 13.5 1.5 13.5 L 3 13.5 L 3 22.5 C 3 23.324219 3.675781 24 4.5 24 L 9 24 L 9 16.5 C 9 15.675781 9.675781 15 10.5 15 L 13.5 15 C 14.324219 15 15 15.675781 15 16.5 L 15 24 L 19.5 24 C 20.324219 24 21 23.324219 21 22.5 L 21 13.5 L 22.5 13.5 C 23.351562 13.5 24 12.84375 24 12 C 24 11.34375 23.644531 10.988281 23.175781 10.5 Z M 23.175781 10.5"
/>
</svg>
);
}