Skip to content

Commit

Permalink
docs: updata blog page style
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <[email protected]>
  • Loading branch information
coder-sett committed Oct 30, 2023
1 parent d580d6e commit c0aa3bd
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules_i18n/community-zh
Submodule community-zh updated 28 files
+0 −1 blog/ChinaSoftDevelopmentConference/2023-04-22-china-software.mdx
+0 −1 blog/GOTC-2023/2023-05-25-GOTC-compass-forum.mdx
+0 −1 blog/GOTC-2023/2023-06-15-GOTC-compass-highlights.mdx
+0 −1 blog/GOTC-2023/2023-06-15-release-of-new-features.mdx
+0 −1 blog/GOTC-2023/2023-06-15-shared-slides-eco-system-theory.mdx
+0 −1 blog/OpenDigger/2023-03-17-opendigger.mdx
+0 −1 blog/PHPUnit/2023-03-21-phpunit.mdx
+0 −1 blog/compass-at-oss-eu/2023-09-18-compass-at-oss-eu.mdx
+0 −1 blog/compass-badge/2023-07-22-compass-badge.mdx
+0 −1 blog/evaluate-open-source/2023-02-27-evaluate-open-source.mdx
+0 −1 blog/evaluate-open-source/2023-03-15-compass-introduce.mdx
+0 −1 blog/evaluate-open-source/2023-04-26-open-source-rainforest.mdx
+0 −1 blog/evaluate-open-source/2023-05-26-compass-new-feature.mdx
+0 −1 blog/evaluate-open-source/2023-06-07-how-to-use-compass.mdx
+0 −1 blog/explore-compass-lab/2023-09-01-explore-compass-lab.mdx
+0 −1 blog/first-board-meeting/2023-09-01-first-board-meeting.mdx
+0 −1 blog/foresee-pytorch/2023-09-28-foresee-pytorch.mdx
+0 −1 blog/jianmu/2023-03-21-jianmu.mdx
+0 −1 blog/launch-news/2023-02-14-imminent-launch.mdx
+0 −1 blog/launch-news/2023-02-21-compass-launch.mdx
+0 −1 blog/release-white-paper/2023-09-28-release-white-paper.mdx
+0 −1 blog/scoring-system-switch/2023-08-05-scoring-system-switch.mdx
+0 −1 blog/supports-ccf-papers/2023-09-15-supports-ccf-papers.mdx
+0 −1 blog/thrives-since-launch/2023-06-09-thrives-since-launch.mdx
+0 −1 blog/visit-project-categories/2023-09-15-visit-project-categories.mdx
+0 −1 blog/welcome-doctoral-students/2023-08-11-welcome-doctoral-students.mdx
+0 −1 blog/y-axis-scaling/2023-07-28-y-axis-scaling.mdx
+133 −0 meeting minutes/meeting-minutes_Zh-CN.md
9 changes: 9 additions & 0 deletions src/theme/BlogSidebar/Desktop/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
import type { Props } from "@theme/BlogSidebar/Desktop";
export default function BlogSidebarDesktop({ sidebar }: Props): JSX.Element;
54 changes: 54 additions & 0 deletions src/theme/BlogSidebar/Desktop/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright (c) Meta Platforms, Inc. and 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 clsx from 'clsx';
import Link from '@docusaurus/Link';
import { translate } from '@docusaurus/Translate';
import styles from './styles.module.css';

export default function BlogSidebarDesktop ({ sidebar }) {
return (
<aside className="col col--3">
<nav
className={clsx(styles.sidebar, 'thin-scrollbar')}
aria-label={translate({
id: 'theme.blog.sidebar.navAriaLabel',
message: 'Blog recent posts navigation',
description: 'The ARIA label for recent posts in the blog sidebar',
})}>
<div className={clsx(styles.sidebarHeader, 'margin-bottom--md')}>
{sidebar.title}
</div>
<ul className={clsx(styles.sidebarItemList, 'clean-list')}>
{sidebar.items.map(item => {
console.log(item.permalink)
const postYear = item.permalink.split('/')[2] + '-' + item.permalink.split('/')[3] + '-' + item.permalink.split('/')[4];
const yearHeader = (
<div className={styles.sidebarItemTitle}>{postYear}</div>
);
return (
<>
<li key={item.permalink} className={styles.sidebarItem}>
<Link
isNavLink
to={item.permalink}
className={styles.sidebarItemLink}
activeClassName={styles.sidebarItemLinkActive}>
{item.title}
{yearHeader}
</Link>
</li>

</>
);
})}
</ul>
</nav>
</aside>
);
}
65 changes: 65 additions & 0 deletions src/theme/BlogSidebar/Desktop/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

.sidebar {
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
overflow-y: auto;
position: sticky;
top: var(--ifm-navbar-height);
padding: 20px 12px 0 0;
margin-left: -20px;
}

.sidebarHeader {
font-size: var(--ifm-h4-font-size);
font-weight: var(--ifm-font-weight-bold);
padding-left: 12px;
display: block;
}

.sidebarItemTitle {
color: #999;
margin-top: 3px;
}

.sidebarItemList {
font-size: 13px;
}

.sidebarItem {
margin-top: 0.1rem;
line-height: 18px;
}

.sidebarItemLink {
color: var(--ifm-font-color-base);
padding: 0.7rem 8px;
display: block;
border-left: 4px solid transparent;
border-radius: 0.25rem;
line-height: 18px;
border-bottom: 1px solid #eee;
}

.sidebarItemLink:hover {
background: var(--ifm-menu-color-background-active);
color: var(--ifm-font-color-base);
text-decoration: none;
}

.sidebarItemLinkActive {
color: var(--ifm-font-color-base);
background: var(--ifm-menu-color-background-active);
border-left-color: var(--ifm-menu-color-active);
font-weight: 700;
}

@media (max-width: 996px) {
.sidebar {
display: none;
}
}
9 changes: 9 additions & 0 deletions src/theme/BlogSidebar/Mobile/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
import type { Props } from "@theme/BlogSidebar/Mobile";
export default function BlogSidebarMobile(props: Props): JSX.Element;
47 changes: 47 additions & 0 deletions src/theme/BlogSidebar/Mobile/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright (c) Meta Platforms, Inc. and 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 Link from '@docusaurus/Link';
import { NavbarSecondaryMenuFiller } from '@docusaurus/theme-common';
import styles from './styles.module.css';

function BlogSidebarMobileSecondaryMenu ({ sidebar }) {
let cachedYear = null;
return (
<ul className="menu__list blog-menu__list">
{sidebar.items.map(item => {
const postYear = item.permalink.split('/')[2] + '-' + item.permalink.split('/')[3] + '-' + item.permalink.split('/')[4];
const yearHeader = (
<div className={styles.sidebarItemTitle}>{postYear}</div>
);
return (
<>
<li key={item.permalink} className="menu__list-item">
<Link
isNavLink
to={item.permalink}
className="menu__link"
activeClassName="menu__link--active">
{item.title}
{yearHeader}
</Link>
</li>
</>
);
})}
</ul>
);
}
export default function BlogSidebarMobile (props) {
return (
<NavbarSecondaryMenuFiller
component={BlogSidebarMobileSecondaryMenu}
props={props}
/>
);
}
14 changes: 14 additions & 0 deletions src/theme/BlogSidebar/Mobile/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

.sidebarItemTitle {
margin: 0.75rem 0 0.5rem;
color: var(--subtle);
padding-left: 12px;
border-bottom: 0.01rem solid var(--ifm-table-border-color);
padding-bottom: 4px;
}

1 comment on commit c0aa3bd

@vercel
Copy link

@vercel vercel bot commented on c0aa3bd Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.