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

[docs][base] Show components & hooks API on the components page #35938

Merged
merged 101 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
f1fde60
[docs] Add hooks API pages
mnajdova Jan 14, 2023
e079c7c
more progress
mnajdova Jan 16, 2023
0ae093f
more fixes
mnajdova Jan 16, 2023
092f1de
link hooks in the component's API section
mnajdova Jan 16, 2023
6c1ee0e
fix default values
mnajdova Jan 17, 2023
1f69369
cleanup
mnajdova Jan 17, 2023
542ce9f
link other hooks on the unstyled component pages
mnajdova Jan 17, 2023
a9400c4
add annotation on the hooks
mnajdova Jan 17, 2023
7c2c19b
small fixes
mnajdova Jan 18, 2023
dc56c8e
Add return value generation logic & UseButtonReturnValue interface
mnajdova Jan 18, 2023
bd3d393
Fix useMenuItem ts issue
mnajdova Jan 18, 2023
7f56ce9
Fix UseButtonReturnValue
mnajdova Jan 18, 2023
a5e213b
Update docs/src/modules/components/AppNavDrawer.js
mnajdova Jan 18, 2023
ce67b74
yarn docs:api
mnajdova Jan 18, 2023
6f0c397
Merge branch 'docs/build-hooks-interfaces' of https://github.com/mnaj…
mnajdova Jan 18, 2023
4a38c6a
updated parseMarkdown tests
mnajdova Jan 18, 2023
aa31bd7
Improve the demos link to point to the hook section
mnajdova Jan 19, 2023
54e5e19
Resolve comments from backlog grooming
mnajdova Jan 21, 2023
a5c2670
Renamed inputParams to parameters, renamed returnValue hash to return…
mnajdova Jan 23, 2023
1406831
Show optional abbr for return value
mnajdova Jan 23, 2023
ebf4760
Extract the PropertiesTable in a standalone component
mnajdova Jan 23, 2023
516d805
Merge branch 'master' into docs/build-hooks-interfaces
mnajdova Jan 24, 2023
ae9aa4a
prettier
mnajdova Jan 24, 2023
00c387c
Renamed Sidebar Component API group to API
mnajdova Jan 24, 2023
9109535
[poc] API tabs in the components pages
mnajdova Jan 24, 2023
818db5f
Make all tabs working
mnajdova Jan 24, 2023
9df6d1f
link component API page to the correct tab
mnajdova Jan 25, 2023
5a681bb
prettier
mnajdova Jan 25, 2023
88662d2
React on query change if on the same page
mnajdova Jan 25, 2023
4dac374
Remove API from toc
mnajdova Jan 25, 2023
cbd8c4e
Place the tabs before the ad, make the tabs sticky in the header
mnajdova Jan 25, 2023
3285aec
Append query param on tab click
mnajdova Jan 25, 2023
65bac95
Update docs/src/modules/components/ComponentPageTabs.js
mnajdova Jan 25, 2023
0a2714f
Hide tabs, instead of re-rendering them, updated the JSdocs for the u…
mnajdova Jan 27, 2023
070c23e
Merge branch 'poc/hook-api-links' of https://github.com/mnajdova/mate…
mnajdova Jan 27, 2023
7375be5
Fix layout shift on ad
mnajdova Jan 27, 2023
1ac4320
Merge branch 'master' into poc/hook-api-links
mnajdova Feb 6, 2023
76db35d
merge conflicts
mnajdova Feb 6, 2023
aeddc79
Add components & demo tabs for the react-tabs page
mnajdova Feb 6, 2023
7b63565
Link API pages correctly
mnajdova Feb 7, 2023
2a0bc36
Improve the tab bars sticky position styles in all screen sizes
mnajdova Feb 8, 2023
8bd1a99
tabs in the header design tweaks + a couple of things more
danilo-leal Feb 10, 2023
2599f1d
fix chips bg color on dark mode
danilo-leal Feb 10, 2023
cdcd600
Merge branch 'master' into poc/hook-api-links
mnajdova Feb 10, 2023
aa9150a
fix scroll margin top
danilo-leal Feb 12, 2023
ff825b8
fix tabs width on mobile
danilo-leal Feb 12, 2023
e18b6a3
remove seemingly unnecessary heading padding
danilo-leal Feb 12, 2023
9f1b2d7
Merge branch 'poc/hook-api-links' of https://github.com/mnajdova/mate…
mnajdova Feb 13, 2023
0ace11c
Merge branch 'master' into poc/hook-api-links
mnajdova Feb 13, 2023
ac029ae
Fix import spacing
mnajdova Feb 14, 2023
85683d1
Merge branch 'master' into poc/hook-api-links
mnajdova Feb 28, 2023
698b744
add step in the yarn docs:api to update the react pages js files
mnajdova Feb 28, 2023
f3e1ae5
add static paths
mnajdova Mar 1, 2023
4e046d8
Try different export mapping
mnajdova Mar 1, 2023
a7eb62e
few changes
mnajdova Mar 2, 2023
dedd0b1
conflicting paths
mnajdova Mar 2, 2023
29284a3
Fix ssr on the demos page
mnajdova Mar 2, 2023
a1eca78
active page should always be the components page
mnajdova Mar 2, 2023
ab1e1e5
active page fix
mnajdova Mar 2, 2023
b70263f
Improve open in new tab/window scenarios
mnajdova Mar 2, 2023
dcb2a53
prettier
mnajdova Mar 2, 2023
a3c8c81
generate correct api pages, update pages for all components
mnajdova Mar 3, 2023
8178f97
add the tabs on all pages
mnajdova Mar 3, 2023
fb9aec4
Merge branch 'master' into poc/hook-api-links
mnajdova Mar 3, 2023
d288bf3
update docs:api
mnajdova Mar 3, 2023
9b124cf
merge conflict correctly resolved
mnajdova Mar 3, 2023
b1ae2ea
[docs] Hooks api tabs alternative links v2
mnajdova Mar 6, 2023
4597e20
make server side tab indicator styles closer to hydrated
mnajdova Mar 13, 2023
488ec78
Fix scroll
mnajdova Mar 13, 2023
a3ad0bf
remove transition between shallow links
mnajdova Mar 13, 2023
a821950
Resolve the last comments
mnajdova Mar 13, 2023
6de66ba
Update the build script to generate the new structure of the files, r…
mnajdova Mar 15, 2023
8615acc
fixed some lint issues
mnajdova Mar 15, 2023
cffb308
fix wrong import
mnajdova Mar 15, 2023
b525835
Update docs/src/modules/components/AppTableOfContents.js
mnajdova Mar 15, 2023
d3ec3c7
improve the API links
mnajdova Mar 15, 2023
bafed49
change the api links to plural
mnajdova Mar 15, 2023
25d6777
Fix error for active page
mnajdova Mar 15, 2023
cb7deb7
Update the JSDocs descriptions
mnajdova Mar 16, 2023
dfadb05
Fix wrong prop type definition
mnajdova Mar 16, 2023
f3bd253
prettier
mnajdova Mar 16, 2023
0a888e2
Update the buildApi script to not generate the old format of the api …
mnajdova Mar 16, 2023
9f1f788
still generate the json files
mnajdova Mar 16, 2023
7c4fbf8
fix lint issues & add test
mnajdova Mar 16, 2023
d9f1b10
Merge branch 'master' into poc/hook-api-links
mnajdova Mar 16, 2023
197c8a5
simplify index pages, use translations
mnajdova Mar 16, 2023
d275fed
improve the name of the method for generating pages
mnajdova Mar 16, 2023
2cab5f2
simplify the code in buildApiUtils
mnajdova Mar 16, 2023
b120b8c
Merge branch 'master' into poc/hook-api-links
mnajdova Mar 23, 2023
500982e
fix hooks import statement, remove description from API page
mnajdova Mar 23, 2023
2371cc5
remove unused var
mnajdova Mar 23, 2023
e852285
update test
mnajdova Mar 23, 2023
5bdd759
Jun's review
mnajdova Mar 24, 2023
87f3bc9
Resolve comments
mnajdova Mar 28, 2023
df7ff54
tweak divider styles
danilo-leal Mar 28, 2023
db913bd
last batch of design tweaks
danilo-leal Mar 28, 2023
9c8b350
one more detail
danilo-leal Mar 28, 2023
051e12b
Merge branch 'master' into poc/hook-api-links
mnajdova Mar 29, 2023
e4f723b
add useOption hook in the docs
mnajdova Mar 29, 2023
4ae86fe
add redirects
mnajdova Mar 29, 2023
1ddf6e8
Merge branch 'master' into poc/hook-api-links
mnajdova Mar 31, 2023
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
Prev Previous commit
Next Next commit
tabs in the header design tweaks + a couple of things more
  • Loading branch information
danilo-leal committed Feb 10, 2023
commit 8bd1a997013fb4a70b8037f578292e7dc4e3631a
4 changes: 2 additions & 2 deletions docs/data/base/components/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/button/

<p class="description">Buttons let users take actions and make choices with a single tap.</p>

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

{{"component": "modules/components/ComponentPageTabs.js"}}

## Introduction
Expand All @@ -19,8 +21,6 @@ The Unstyled Button component replaces the native HTML `<button>` element, and o

{{"demo": "UnstyledButtonIntroduction.tsx", "defaultCodeOpen": false, "bg": "gradient"}}

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Component

### Usage
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/tabs/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/tabpanel/

<p class="description">Tabs are UI elements for organizing and navigating between groups of related content.</p>

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

{{"component": "modules/components/ComponentPageTabs.js"}}

## Introduction
Expand All @@ -24,8 +26,6 @@ Tabs are implemented using a collection of related components:

{{"demo": "UnstyledTabsIntroduction.tsx", "defaultCodeOpen": false, "bg": "gradient"}}

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Components

### Usage
Expand Down
29 changes: 27 additions & 2 deletions docs/src/modules/brandingTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,11 @@ export function getThemedComponents(): ThemeOptions {
fontWeight: 500,
...(variant === 'outlined' &&
color === 'default' && {
backgroundColor: 'transparent',
backgroundColor: alpha(theme.palette.grey[50], 0.5),
color: (theme.vars || theme).palette.grey[900],
borderColor: (theme.vars || theme).palette.grey[200],
'&:hover': {
backgroundColor: (theme.vars || theme).palette.grey[100],
color: (theme.vars || theme).palette.grey[900],
},
...theme.applyDarkStyles({
Expand Down Expand Up @@ -737,6 +738,30 @@ export function getThemedComponents(): ThemeOptions {
defaultProps: {
disableTouchRipple: true,
},
styleOverrides: {
root: ({ theme }) => [
{
padding: theme.spacing(1),
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1),
fontWeight: 600,
minHeight: 32,
minWidth: 0,
borderRadius: 12,
'&:hover': {
background: (theme.vars || theme).palette.grey[50],
},
},
theme.applyDarkStyles({
'&:hover': {
background: (theme.vars || theme).palette.primaryDark[700],
},
'&.Mui-selected': {
color: (theme.vars || theme).palette.primary[300],
},
}),
],
},
},
MuiPaper: {
styleOverrides: {
Expand Down Expand Up @@ -829,7 +854,7 @@ export function getThemedComponents(): ThemeOptions {
MuiTooltip: {
styleOverrides: {
tooltip: {
padding: '5px 9px',
padding: '6px 12px',
},
},
},
Expand Down
41 changes: 19 additions & 22 deletions docs/src/modules/components/ComponentLinkHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SketchIcon from 'docs/src/modules/components/SketchIcon';
import FigmaIcon from 'docs/src/modules/components/FigmaIcon';
import AdobeXDIcon from 'docs/src/modules/components/AdobeXDIcon';
import BundleSizeIcon from 'docs/src/modules/components/BundleSizeIcon';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import ChatRounded from '@mui/icons-material/ChatRounded';
import W3CIcon from 'docs/src/modules/components/W3CIcon';
import MaterialDesignIcon from 'docs/src/modules/components/MaterialDesignIcon';
import { styled } from '@mui/material/styles';
Expand All @@ -18,10 +18,7 @@ const Root = styled('ul')(({ theme }) => ({
listStyle: 'none',
display: 'flex',
flexWrap: 'wrap',
marginBottom: theme.spacing(2),
'& li': {
margin: theme.spacing(0.5),
},
gap: 8,
'& .MuiChip-root .MuiChip-iconSmall': {
marginLeft: 4,
},
Expand Down Expand Up @@ -58,7 +55,7 @@ export default function ComponentLinkHeader(props) {
href={`${process.env.SOURCE_CODE_REPO}/labels/${encodeURIComponent(
headers.githubLabel,
)}`}
icon={<InfoOutlinedIcon />}
icon={<ChatRounded color="primary" />}
data-ga-event-category="ComponentLinkHeader"
data-ga-event-action="click"
data-ga-event-label={t('githubLabel')}
Expand All @@ -67,44 +64,44 @@ export default function ComponentLinkHeader(props) {
/>
</li>
) : null}
{headers.waiAria ? (
<li>
<li>
<Tooltip title={t('bundleSizeTooltip')}>
<Chip
clickable
role={undefined}
component="a"
size="small"
variant="outlined"
rel="nofollow"
href={headers.waiAria}
icon={<W3CIcon />}
href={`https://bundlephobia.com/package/${packageName}@latest`}
icon={<BundleSizeIcon color="primary" />}
data-ga-event-category="ComponentLinkHeader"
data-ga-event-action="click"
data-ga-event-label="WAI-ARIA"
data-ga-event-label={t('bundleSize')}
data-ga-event-split="0.1"
label="WAI-ARIA"
label={t('bundleSize')}
/>
</li>
) : null}
<li>
<Tooltip title={t('bundleSizeTooltip')}>
</Tooltip>
</li>
{headers.waiAria ? (
<li>
<Chip
clickable
role={undefined}
component="a"
size="small"
variant="outlined"
rel="nofollow"
href={`https://bundlephobia.com/package/${packageName}@latest`}
icon={<BundleSizeIcon />}
href={headers.waiAria}
icon={<W3CIcon color="primary" />}
data-ga-event-category="ComponentLinkHeader"
data-ga-event-action="click"
data-ga-event-label={t('bundleSize')}
data-ga-event-label="WAI-ARIA"
data-ga-event-split="0.1"
label={t('bundleSize')}
label="WAI-ARIA"
/>
</Tooltip>
</li>
</li>
) : null}
{headers.materialDesign ? (
<li>
<Chip
Expand Down
15 changes: 11 additions & 4 deletions docs/src/modules/components/ComponentPageTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Link from 'docs/src/modules/components/Link';
import { useTranslate } from 'docs/src/modules/utils/i18n';
import { alpha } from '@mui/material/styles';

export default function ComponentPageTabs(props) {
const {
Expand All @@ -21,11 +22,17 @@ export default function ComponentPageTabs(props) {
onChange={(e, value) => setActiveTab(value)}
sx={{
position: 'sticky',
// to be positioned below the app bar
top: 65,
mx: -2,
backgroundColor: theme => theme.palette.mode === 'dark' ? 'rgba(10, 25, 41, 0.7)' : 'rgba(255,255,255,0.8)',
top: 65, // to be positioned below the app bar
pt: 1,
backgroundColor: (theme) =>
theme.palette.mode === 'dark'
? alpha(theme.palette.primaryDark[900], 0.7)
: 'rgba(255,255,255,0.8)',
backdropFilter: 'blur(8px)',
borderBottom: 1,
borderColor: 'divider',
zIndex: 1000,
mt: 3,
}}
>
<Tab label="Demos" value="" />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/MarkdownElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const Root = styled('div')(
'& .description': {
...lightTheme.typography.subtitle1,
fontWeight: 400,
margin: '0 0 40px',
margin: '0 0 28px',
},
'& .component-tabs': {
margin: '0 0 40px',
Expand Down