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

Replace current theme components with @swmansion/t-rex-ui #2906

Merged
merged 21 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2de02fe
Bump @swmansion/t-rex-ui
patrycjakalinska May 13, 2024
60e5961
Use sidebar from @swmansion/t-rex-ui
patrycjakalinska May 13, 2024
4c8a83d
Use Admonition from @swmansion/t-rex-ui
patrycjakalinska May 13, 2024
2fb32e7
Use Table of Contents from @swmansion/t-rex-ui
patrycjakalinska May 13, 2024
5644d3f
Use Footer from @swmansion/t-rex-ui
patrycjakalinska May 14, 2024
6ffc495
Use Navbar from @swmansion/t-rex-ui
patrycjakalinska May 14, 2024
874aa8a
Code clean up
patrycjakalinska May 14, 2024
a6335b6
temporary fix for ColorModeToggle
patrycjakalinska May 14, 2024
48c2de8
Use PaginatorNavLink from `@swmansion/t-rex-ui`
patrycjakalinska May 14, 2024
e177e44
Use SearchPage from @swmansion/t-rex-ui
patrycjakalinska May 15, 2024
80a0223
Adjustments for colors
patrycjakalinska May 15, 2024
a0b35e9
Bump `@swmansion/t-rex-ui` to 4.0.0
patrycjakalinska May 15, 2024
aeb5cd4
Bump `@swmansion/t-rex-ui` to 0.0.5
patrycjakalinska May 15, 2024
27b2336
Bump `@swmansion/t-rex-ui` to 0.0.6
patrycjakalinska May 16, 2024
3111c2c
Removed unneccessary styles after `@swmansion/t-rex-ui` patch
patrycjakalinska May 20, 2024
67e348d
Bump `@swmansion/t-rex-ui` to 0.0.7
patrycjakalinska May 21, 2024
7c52d30
fixes for titleImage on landing
patrycjakalinska May 22, 2024
010a16a
Bump @swmansion/t-rex-ui to 0.0.9
patrycjakalinska May 22, 2024
ce9653a
Add Searchbar fixing class
patrycjakalinska May 22, 2024
c674c1a
Remove unneccessary Fragment
patrycjakalinska May 22, 2024
2353fd9
Add TODO prompt
patrycjakalinska May 22, 2024
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
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@emotion/styled": "^11.10.6",
"@mdx-js/react": "^1.6.22",
"@mui/material": "^5.12.0",
"@swmansion/t-rex-ui": "^0.0.3",
"@swmansion/t-rex-ui": "^0.0.9",
"@vercel/og": "^0.6.2",
"babel-polyfill": "^6.26.0",
"babel-preset-expo": "^9.2.2",
Expand Down
10 changes: 7 additions & 3 deletions docs/src/css/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
--swm-color-mode-enabled: var(--swm-navy-light-20);
--swm-color-mode-disabled-color: var(--swm-navy-light-20);

--swm-color-mode-enabled-landing: var(--swm-off-white);
--swm-color-mode-enabled-color-landing: var(--ifm-font-color-base);
--swm-color-mode-disabled-color-landing: var(--swm-off-white);
--swm-color-mode-enabled-landing: var(--ifm-font-color-base);
--swm-color-mode-enabled-color-landing: var(--swm-off-white);
--swm-color-mode-disabled-color-landing: var(--ifm-font-color-base);

/* Typography */
--ifm-heading-color: var(--ifm-color-primary);
Expand Down Expand Up @@ -211,6 +211,8 @@
--swm-search-hit-border-hover: var(--swm-blue-light-100);
--swm-search-hit-active-color: var(--swm-off-white);

--swm-docsearch-hit-source-color: var(--swm-navy-light-100);

--swm-search-hit-results-color: var(--swm-navy-light-40);

--swm-search-page-query-text-color: var(--swm-navy-light-100);
Expand Down Expand Up @@ -375,6 +377,8 @@
--swm-search-hit-border-hover: var(--swm-blue-dark-40);
--swm-search-hit-active-color: var(--swm-navy-light-100);

--swm-docsearch-hit-source-color: var(--swm-navy-light-10);

--swm-search-hit-results-color: var(--swm-navy-light-20);

--swm-search-page-query-text-color: var(--swm-navy-light-10);
Expand Down
11 changes: 11 additions & 0 deletions docs/src/css/overrides.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
:root {
--swm-expandable-transition: transform 200ms ease;
--ifm-code-font-size: 14px;
--swm-logo-title-width: 177px;
--swm-logo-height: 50px !important;
}

[class*='plugin-pages'] {
Expand Down Expand Up @@ -129,3 +131,12 @@ table thead tr {
-webkit-text-size-adjust: 100%;
}
}

[class*='navbar__link']:not([class*='header-github']):not([role='button']) {
display: none;
}

/* Remove in @swmansion-t-rex-ui 0.0.10 patch */
patrycjakalinska marked this conversation as resolved.
Show resolved Hide resolved
button[class*='DocSearch-Button'] {
margin: 0 !important;
}
142 changes: 2 additions & 140 deletions docs/src/theme/Admonition/index.js
Original file line number Diff line number Diff line change
@@ -1,141 +1,3 @@
import React from 'react';
import clsx from 'clsx';
import { ThemeClassNames } from '@docusaurus/theme-common';
import Translate from '@docusaurus/Translate';
import ThemedImage from '@theme/ThemedImage';
import styles from './styles.module.css';
import useBaseUrl from '@docusaurus/useBaseUrl';
import { Admonition } from '@swmansion/t-rex-ui';

const AdmonitionConfigs = {
note: {
infimaClassName: 'secondary',
label: (
<Translate
id="theme.admonition.note"
description="The default label used for the Note admonition (:::note)">
note
</Translate>
),
},
tip: {
infimaClassName: 'success',
label: (
<Translate
id="theme.admonition.tip"
description="The default label used for the Tip admonition (:::tip)">
tip
</Translate>
),
},
danger: {
infimaClassName: 'danger',
label: (
<Translate
id="theme.admonition.danger"
description="The default label used for the Danger admonition (:::danger)">
danger
</Translate>
),
},
info: {
infimaClassName: 'info',
label: (
<Translate
id="theme.admonition.info"
description="The default label used for the Info admonition (:::info)">
info
</Translate>
),
},
caution: {
infimaClassName: 'caution',
label: (
<Translate
id="theme.admonition.caution"
description="The default label used for the Caution admonition (:::caution)">
caution
</Translate>
),
},
};
// Legacy aliases, undocumented but kept for retro-compatibility
const aliases = {
secondary: 'note',
important: 'info',
success: 'tip',
warning: 'danger',
};

export default function Admonition(props) {
const {
children,
type,
title,
icon: iconProp,
} = processAdmonitionProps(props);
const typeConfig = getAdmonitionConfig(type);
const titleLabel = title ?? typeConfig.label;

const dangerIcon = {
light: useBaseUrl('/img/danger.svg'),
dark: useBaseUrl('/img/danger-dark.svg'),
};

return (
<div
className={clsx(
ThemeClassNames.common.admonition,
ThemeClassNames.common.admonitionType(props.type),
styles.admonition,
'alert',
styles[`alert--${typeConfig.infimaClassName}`]
)}>
<div className={styles.admonitionHeading}>
<div className={styles.admonitionIcon}>
<ThemedImage sources={dangerIcon} />
</div>

{titleLabel}
</div>
<div className={styles.admonitionContent}>{children}</div>
</div>
);

function getAdmonitionConfig(unsafeType) {
const type = aliases[unsafeType] ?? unsafeType;
const config = AdmonitionConfigs[type];
if (config) {
return config;
}
console.warn(
`No admonition config found for admonition type "${type}". Using Info as fallback.`
);
return AdmonitionConfigs.info;
}
}

// Workaround because it's difficult in MDX v1 to provide a MDX title as props
// See https://github.com/facebook/docusaurus/pull/7152#issuecomment-1145779682
function extractMDXAdmonitionTitle(children) {
const items = React.Children.toArray(children);
const mdxAdmonitionTitle = items.find(
(item) =>
React.isValidElement(item) && item.props?.mdxType === 'mdxAdmonitionTitle'
);
const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}</>;
return {
mdxAdmonitionTitle,
rest,
};
}

function processAdmonitionProps(props) {
const { mdxAdmonitionTitle, rest } = extractMDXAdmonitionTitle(
props.children
);
return {
...props,
title: props.title ?? mdxAdmonitionTitle,
children: rest,
};
}
export default Admonition;
84 changes: 0 additions & 84 deletions docs/src/theme/Admonition/styles.module.css

This file was deleted.

80 changes: 0 additions & 80 deletions docs/src/theme/ColorModeToggle/index.js

This file was deleted.

Loading
Loading