Skip to content

Docs UX fixes #3673

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

Merged
merged 3 commits into from
Apr 6, 2025
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
5 changes: 5 additions & 0 deletions docuilib/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ const darkCodeTheme = themes.dracula;
},
colorMode: {
disableSwitch: true
},
docs: {
sidebar: {
autoCollapseCategories: true
}
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion docuilib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uilib-docs",
"version": "3.21.0",
"version": "3.22.0",
"main": "./src/index.ts",
"scripts": {
"docusaurus": "docusaurus",
Expand Down
Binary file added docuilib/src/assets/icons/code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions docuilib/src/assets/icons/code.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions docuilib/src/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const CodeBlock: React.FC<CodeBlockProps> = ({

const containerStyle = useMemo<ComponentProps<'div'>['style']>(() => {
return {
fontSize,
maxWidth: printWidth * fontSize
fontSize
// maxWidth: printWidth * fontSize
};
}, [fontSize, printWidth]);

Expand All @@ -31,7 +31,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
<ThemeCodeBlock
className={styles.codeBlock}
language={language ?? 'jsx'}
showLineNumbers={showLineNumbers ?? true}
showLineNumbers={showLineNumbers}
{...others}
>
{code}
Expand Down
18 changes: 14 additions & 4 deletions docuilib/src/components/pageComponents/ContentItem.module.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
.showCodeButton {
position: absolute;
border: 0;
border: 1px solid #ddd;
border-radius: 4px;
padding: 4px;
background: none;
color: rgb(56, 153, 236);
cursor: pointer;
display: flex;
align-items: center;
right: 0px;
top: 0px;
right: 4px;
top: 4px;

&:hover {
background: #eee;
}

img {
filter: grayscale(100%);
opacity: 0.8;
}
}

.blocker {
Expand Down
6 changes: 3 additions & 3 deletions docuilib/src/components/pageComponents/ContentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {LiveProvider, LivePreview} from 'react-live';
import styles from './ContentItem.module.scss';
import ReactLiveScope from '../../theme/ReactLiveScope';
import CodeBlock from '../CodeBlock';
import CodeIcon from '../../assets/icons/code';
import {isComponentSupported} from '../../utils/componentUtils';
const showCodeIcon = require('../../assets/icons/code.png');

type ComponentItemProps = {
componentName: string;
Expand Down Expand Up @@ -71,8 +71,8 @@ const ComponentItem = (props: ComponentItemProps) => {
{content}
{showCodeButton && (
<button onClick={toggleCode} className={styles.showCodeButton}>
<CodeIcon/>
{showCode ? 'Hide' : 'Show'} code
<img src={showCodeIcon} width={20}/>
{/* {showCode ? 'Hide' : 'Show'} code */}
</button>
)}
</div>
Expand Down
12 changes: 10 additions & 2 deletions docuilib/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.3);
}

/* Markdown pages */

.container {
padding: 0 48px;
}

/** Docusaurus Navbar */

.navbar {
Expand All @@ -58,7 +64,7 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
letter-spacing: 0.3px;
line-height: 38px;
border-bottom: 2px solid transparent;
transition: all 0.2s ease-out;
transition: all 0.18s ease-out;
}
.navbar__link--active {
font-weight: 700;
Expand Down Expand Up @@ -207,8 +213,10 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
border-bottom: 2px solid #F0F2F5;
}
.single-tab {
font-size: 20px;
font-size: 18px;
font-weight: 500;
color: #6E7881;
border-bottom-width: 2px;
}
.single-tab[aria-selected='true'] {
border-bottom-color: #20303C;
Expand Down