Skip to content

Commit

Permalink
docs: add @swmansion/t-rex-ui (#2895)
Browse files Browse the repository at this point in the history
## Description

Because of a ramping up maintainance cost across our suite of tools -
Reanimated, Gesture Handler & React Native IDE we've decided to create a
UI library for our reusable docusaurus components.

The
[`@swmansion/t-rex-ui`](https://github.com/software-mansion-labs/t-rex-ui)
package aims to unify the components across our documentations. This
will make the maintainance easier in the long term by code reuse. We
hope that with a single source of truth will avoid the need of fixing a
bug in 3-4 places instead of just one.

Sidenote: the package requires the React & ReactDOM in version `18` or
higher.

## Test plan

```
cd docs/
yarn

# to test development build
yarn start

# to test production build
yarn build
yarn serve
```

---------

Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
  • Loading branch information
kacperkapusciak and j-piasecki authored May 13, 2024
1 parent 51cf28b commit cc05007
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 66 deletions.
5 changes: 3 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
"@emotion/styled": "^11.10.6",
"@mdx-js/react": "^1.6.22",
"@mui/material": "^5.12.0",
"@swmansion/t-rex-ui": "^0.0.1",
"@vercel/og": "^0.6.2",
"babel-polyfill": "^6.26.0",
"babel-preset-expo": "^9.2.2",
"babel-preset-react-native": "^4.0.1",
"clsx": "^1.2.1",
"raf": "^3.4.1",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react": "^18.3.1",
"react-colorful": "^5.6.1",
"react-dom": "^17.0.2",
"react-dom": "^18.3.1",
"react-draggable": "^4.4.5",
"react-native": "^0.71.4",
"react-native-gesture-handler": "^2.16.0",
Expand Down
44 changes: 2 additions & 42 deletions docs/src/theme/PaginatorNavLink/index.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
import React from 'react';
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import styles from './styles.module.css';
import ThemedImage from '@theme/ThemedImage';
import useBaseUrl from '@docusaurus/useBaseUrl';
import { PaginatorNavLink } from '@swmansion/t-rex-ui';

export default function PaginatorNavLink(props) {
const { permalink, title, subLabel, isNext } = props;
const rightArrow = {
light: useBaseUrl('/img/arrow-right.svg'),
dark: useBaseUrl('/img/arrow-right-dark.svg'),
};

const leftArrow = {
light: useBaseUrl('/img/arrow-left.svg'),
dark: useBaseUrl('/img/arrow-left-dark.svg'),
};

return (
<Link
className={clsx(
styles.pagination,
'pagination-nav__link',
isNext ? 'pagination-nav__link--next' : 'pagination-nav__link--prev'
)}
to={permalink}>
{subLabel && (
<div
className={clsx(
styles.paginationSublabel,
isNext ? styles.paginationNext : styles.paginationPrevious
)}>
<div className={styles.paginationArrow}>
<ThemedImage sources={isNext ? rightArrow : leftArrow} />
</div>
<div className="pagination-nav__sublabel">{subLabel}</div>
</div>
)}
<div className="pagination-nav__label">{title}</div>
</Link>
);
}
export default PaginatorNavLink;
52 changes: 30 additions & 22 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@
utility-types "^3.10.0"
webpack "^5.73.0"

"@docusaurus/plugin-content-docs@2.4.3":
"@docusaurus/plugin-content-docs@2.4.3", "@docusaurus/plugin-content-docs@^2.4.3":
version "2.4.3"
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-2.4.3.tgz#aa224c0512351e81807adf778ca59fd9cd136973"
integrity sha512-N7Po2LSH6UejQhzTCsvuX5NOzlC+HiXOVvofnEPj0WhMu1etpLEXE6a4aTxrtg95lQ5kf0xUIdjX9sh3d3G76A==
Expand Down Expand Up @@ -1960,7 +1960,7 @@
"@types/react" "*"
prop-types "^15.6.2"

"@docusaurus/theme-classic@2.4.3":
"@docusaurus/theme-classic@2.4.3", "@docusaurus/theme-classic@^2.4.3":
version "2.4.3"
resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.4.3.tgz#29360f2eb03a0e1686eb19668633ef313970ee8f"
integrity sha512-QKRAJPSGPfDY2yCiPMIVyr+MqwZCIV2lxNzqbyUW0YkrlmdzzP3WuQJPMGLCjWgQp/5c9kpWMvMxjhpZx1R32Q==
Expand Down Expand Up @@ -1991,7 +1991,7 @@
tslib "^2.4.0"
utility-types "^3.10.0"

"@docusaurus/theme-common@2.4.3":
"@docusaurus/theme-common@2.4.3", "@docusaurus/theme-common@^2.4.3":
version "2.4.3"
resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-2.4.3.tgz#bb31d70b6b67d0bdef9baa343192dcec49946a2e"
integrity sha512-7KaDJBXKBVGXw5WOVt84FtN8czGWhM0lbyWEZXGp8AFfL6sZQfRTluFp4QriR97qwzSyOfQb+nzcDZZU4tezUw==
Expand Down Expand Up @@ -3041,6 +3041,17 @@
"@svgr/plugin-jsx" "^6.5.1"
"@svgr/plugin-svgo" "^6.5.1"

"@swmansion/t-rex-ui@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@swmansion/t-rex-ui/-/t-rex-ui-0.0.1.tgz#051045e34e33b040ae2e1a3aa8c1ad18f200a77b"
integrity sha512-+kbYGtyJB6bvjhDAcqyxumXyb1aSgSXRYEyDbpY8nJGFlTP4NgGp/2ZXweSgNINsPCjgt0HayRG2DTZb8zvUbQ==
dependencies:
"@docusaurus/core" "^2.4.3"
"@docusaurus/module-type-aliases" "^2.4.3"
"@docusaurus/plugin-content-docs" "^2.4.3"
"@docusaurus/theme-classic" "^2.4.3"
"@docusaurus/theme-common" "^2.4.3"

"@szmarczak/http-timer@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421"
Expand Down Expand Up @@ -10502,14 +10513,13 @@ react-devtools-core@^4.26.1:
shell-quote "^1.6.1"
ws "^7"

react-dom@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
react-dom@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"
scheduler "^0.23.2"

react-draggable@^4.4.5:
version "4.4.5"
Expand Down Expand Up @@ -10761,13 +10771,12 @@ react-transition-group@^4.4.5:
loose-envify "^1.4.0"
prop-types "^15.6.2"

react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
react@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

read-package-json-fast@^3.0.0, read-package-json-fast@^3.0.2:
version "3.0.2"
Expand Down Expand Up @@ -11277,21 +11286,20 @@ sax@^1.2.4:
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

scheduler@^0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
dependencies:
loose-envify "^1.1.0"

scheduler@^0.23.2:
version "0.23.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3"
integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==
dependencies:
loose-envify "^1.1.0"

schema-utils@2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7"
Expand Down

0 comments on commit cc05007

Please sign in to comment.