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

Sync with react.dev @ e85b71de #488

Closed
wants to merge 111 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
dc1d580
fix form submit on enter (#5958)
irshathcodes Apr 24, 2023
609533c
Make bundle analysis workflow less fragile (#5971)
gaearon Apr 28, 2023
496c578
Fix the comment action
gaearon Apr 28, 2023
52c777b
Document propTypes (#5974)
gaearon Apr 28, 2023
7ea43a8
Fix typo in useMemo (product.id -> productId) (#5965)
jeonghwan-kim Apr 28, 2023
fd621b8
update chronological order of the React Miami conf (#5977)
M0nica Apr 28, 2023
ef55fb2
Update Fragment.md (#5953)
dexter-stpierre Apr 29, 2023
8ed23b1
Add key param to createPortal reference (#5928)
mattrunyon Apr 29, 2023
68a9343
Fix typo: change 'then' to 'the' (#5978)
Tunzeki Apr 29, 2023
37a12a6
Next Channel -> Canary Channel (#5992)
acdlite May 3, 2023
aa88d8a
Canaries blog post
gaearon May 3, 2023
9a865fd
Revert "Canaries blog post"
gaearon May 3, 2023
69ca3df
Fixes grammar (#5967)
eltronix May 3, 2023
1c55fe8
Canaries blog post (#5993)
gaearon May 3, 2023
1863ab2
tweak
sophiebits May 3, 2023
8e24e40
renderToReadableStream => renders a readable web stream (and not a No…
slorber May 5, 2023
fe5737b
Update Profiler.md (#6000)
declval May 5, 2023
01d44e9
remove cancelled conference 2023 (#5999)
hernanif1 May 5, 2023
07a3ee5
Minor tweak to remove implication that mounting can happen only once …
kassens May 5, 2023
da93812
Conditionally render offset div (#5997)
sami-romdhana May 6, 2023
ebc45f5
Remove unnecessary backticks breaking markdown highlighting (#6025)
mekarthedev May 12, 2023
fd8ba03
docs(types): Fix incorrect period positioning in common.md (#6040)
xilucks May 16, 2023
bea2ff7
fix(typos): replace word "ever" with "every" (#6039)
vicsantizo May 16, 2023
5bc25d3
Add accessibility note to interactivity section in the new React docs…
kmiddleton14 May 18, 2023
1b5e886
Upgrade React and Next (#6011)
sophiebits May 19, 2023
398ace5
Add missing 'it' (#6061)
mekarthedev May 23, 2023
09185bc
Fix a wrong explanation in "Manipulating the DOM with Refs" (#6055)
smikitky May 23, 2023
3364c93
Fix typo: change "intermedinate" to "indeterminate" (#6062)
Tunzeki May 23, 2023
ad4f5c7
Update NextJs link (#6053)
palamarchukser May 30, 2023
4184c0f
Fix a missing word in useLayoutEffect (#6078)
escwxyz May 31, 2023
ca93140
Fix option's mdn link (#6080)
AhmedBaset Jun 2, 2023
8313857
Fix(github-actions): Update gh-actions dependencies to versions that …
AhmedBaset Jun 5, 2023
940e963
Move recent conferences from 'Upcoming' to 'Past' section (#6089)
colemilne54 Jun 8, 2023
9a1e1c6
Fix incorrect inner component reference (#6044)
tdd Jun 9, 2023
f5ffb3f
fix: broken link (#6115)
yuta-ike Jun 26, 2023
292534e
Add basic reference pages for use client and server (#5976)
sophiebits Jun 30, 2023
a30e1f9
update link to fault tolerance blog post (#6142)
aweary Jul 10, 2023
b9eea4d
Fix lint warnings (#6174)
rickhanlonii Jul 21, 2023
d86cfc4
Update useInsertionEffect docs (#6172)
rickhanlonii Jul 24, 2023
cf4ad19
Fix typo: "server-only" to "client-only" (#6164)
smikitky Jul 25, 2023
a132d8f
Remove junk lines in common.md (#6167)
smikitky Jul 25, 2023
6ebe2dd
Fix "onFocus" description (#6168)
smikitky Jul 25, 2023
39b9692
Update conferences timeline (#6159)
afonsojramos Jul 25, 2023
b452e7b
docs: separate dot from hyperlink (#6140)
jjm2317 Jul 25, 2023
505f651
Fix root-unmount returns (#6137)
solar3070 Jul 25, 2023
19c0fe2
fix `componentdidcatch` (#6107)
AhmedBaset Jul 25, 2023
a472775
docs: fix a broken link in react-labs-june-2022 (#6149)
MatanBobi Jul 25, 2023
cd13b52
Fix homepage title (#5838)
daochouwangu Aug 7, 2023
f82f392
Adds a TypeScript overview page (#6120)
orta Aug 9, 2023
c60bcac
Fix TerminalBlock overflow (#6208)
rickhanlonii Aug 10, 2023
03c2e96
Fix recipe titles (#6209)
rickhanlonii Aug 10, 2023
fcc639b
Fix IDs specified in the MDN page URLs (#6176)
natsuokawai Aug 10, 2023
ae06008
Add UI for canary releases (#6173)
rickhanlonii Aug 10, 2023
22d9878
Update correct link common.md (#6125)
NGHdeveloper Aug 10, 2023
02c0067
remove Bad grammar in react.dev tictactoe documentation (#6126)
DIWAKARKASHYAP Aug 11, 2023
a86663d
Fix IntersectionObserver examples (#6212)
rickhanlonii Aug 11, 2023
b1a5b7b
fix(docs): Component reference render parameters (#6098)
brunoeduardodev Aug 11, 2023
2bfa544
removing reference to create-react-app (#6012)
hannanel100 Aug 11, 2023
79560d6
fix: remove Hong Kong from choosing-the-state-structure (#5957)
umairraza96 Aug 11, 2023
819518c
RTL Languages Support (#6138)
AhmedBaset Aug 11, 2023
6b61cd4
Annex to #6138 (#6226)
AhmedBaset Aug 15, 2023
842c24c
Fix broken link for Typescript Discord invite (#6224)
ThomasCharuel Aug 17, 2023
f67811b
Clarify these features are not related to Next (#6229)
lunaleaps Aug 21, 2023
3189529
Add React Native EU 2023 to the conferences page (#6254)
elicwhite Aug 23, 2023
722b546
fix(docs): remove inactive indian meetup groups (#6267)
CarreraPHP Aug 30, 2023
9b4c56a
update conferences to move React Rally 23 to previous and add upcomin…
M0nica Sep 5, 2023
be6c39d
Update tutorial-tic-tac-toe.md (#6259)
0xSaksham Sep 5, 2023
05380da
Update conferences.md (#6256)
ThugDebugger Sep 5, 2023
cd09ffb
Update Twitter(X) icon for light and dark mode (#6235)
venom-10 Sep 5, 2023
230c39b
Fix link in new typescript docs (#6232)
maxjacobson Sep 5, 2023
14629a7
Fix incorrect link in select.md (#6227)
NGHdeveloper Sep 5, 2023
df9d907
Fix flushSync.md grammar (#6282)
minuminukim Sep 6, 2023
7141306
Add cache API docs (#6240)
lunaleaps Sep 6, 2023
9e144cd
Fix typo in preserving-and-resetting-state.md (#6194)
Aleksandar15 Sep 6, 2023
ee98f75
add rendercon kenya 2023 to conferences (#6133)
orama254 Sep 6, 2023
20ccdf9
Update lazy.md to mention default exports (#6285)
sophiebits Sep 7, 2023
46e7b2c
Fixes error in cloneElement code example (#6291)
drex04 Sep 8, 2023
742d2bf
Add use hook API reference page (#6177)
mattcarrollcode Sep 8, 2023
5219d73
Removed the multiple checks (#5759)
abhinav-m22 Sep 9, 2023
43ada1f
Sandpack 2.0: upgrade playgrounds (#5917)
danilowoz Sep 12, 2023
0d21915
Replace label with placeholder (#6295)
kahenya-anita Sep 13, 2023
bdc60c2
FIx typo: props => context (#6300)
smikitky Sep 14, 2023
cbeb0ba
Add French to fully-translated languages (#6305)
tdd Sep 19, 2023
dfd15e8
Remove "robot=noindex" meta tag (#6260)
smikitky Sep 20, 2023
5f3565f
Fix like button color
gaearon Sep 21, 2023
bad7e90
Update team page (#6310)
josephsavona Sep 22, 2023
2ab8334
Update common.md (#6290)
s0h311 Sep 23, 2023
828e30a
chore: log heading missing url error on dev only (#6280)
GSTJ Sep 23, 2023
a1fbcf8
Update useEffect.md - The explanation on the timing of useEffect() ca…
JSerZANP Sep 23, 2023
1758515
Fix text in docs (#6253)
smdmori Sep 23, 2023
2390627
fix links (#6286)
awxiaoxian2020 Sep 23, 2023
91e7f69
Update tutorial error message to use ConsoleBlock
AhmedBaset Sep 25, 2023
4df3e7c
Remove pitfall and update Next link (#6318)
lunaleaps Sep 26, 2023
62b9b45
Main (#5963)
JustLolo Sep 26, 2023
2dbd195
Fix an incorrect person's name (#6066)
jajimajp Sep 26, 2023
01c3163
fix: wrong parameter name defined in explanation (#6158)
MatanBobi Sep 26, 2023
8afb1ef
Add info about App.js 2024 conference (#6192)
piaskowyk Sep 26, 2023
850327d
Update "Start a new React project" for stable Next.js App Router (#6020)
leerob Sep 28, 2023
d4c214a
Update Page not found to React18 URL (#6320)
SouSingh Sep 28, 2023
1dfc88f
fix: typo in useMemo example (#6330)
alainkaiser Oct 1, 2023
68f417a
Explain how `null` ends up in `ref.current` for React-managed refs (#…
eps1lon Oct 1, 2023
c45fa10
Fix "primatives" typo in cache.md (#6335)
psikoi Oct 5, 2023
3cd1723
Mention `use` as a Suspense-enabled data source (#6340)
sophiebits Oct 6, 2023
9aa84b1
Add Experimental Taint API Docs (#6337)
sebmarkbage Oct 6, 2023
fdad54d
Explain limitations of useSyncExternalStore with concurrency (#6339)
sophiebits Oct 9, 2023
88af66d
Fix comma splice
sophiebits Oct 9, 2023
f2c45ea
Add labs icon to experimental APIs (#6346)
sophiebits Oct 9, 2023
43f4702
Fix typo in typescript.md (#6347)
mattcarrollcode Oct 11, 2023
900a669
Upgrade react-collapsed (#5893)
roginfarrer Oct 11, 2023
e85b71d
Add 'ja' to deployedTranslations (#6351)
smikitky Oct 13, 2023
f16e537
merging all conflicts
react-translations-bot Oct 16, 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
1 change: 0 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
SANDPACK_BARE_COMPONENTS=true
3 changes: 1 addition & 2 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
NEXT_PUBLIC_GA_TRACKING_ID = 'UA-41298772-4'
SANDPACK_BARE_COMPONENTS=true
NEXT_PUBLIC_GA_TRACKING_ID = 'UA-41298772-4'
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"plugins": ["@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "warn"
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
"react-hooks/exhaustive-deps": "error"
},
"env": {
"node": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up node
uses: actions/setup-node@v1
with:
node-version: "14.x"
node-version: '20.x'

- name: Install dependencies
uses: bahmutov/[email protected]
Expand All @@ -38,7 +38,7 @@ jobs:
# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report
run: npx -p nextjs-bundle-analysis@0.5.0 report

- name: Upload bundle
uses: actions/upload-artifact@v2
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/analyze_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,9 @@ jobs:
pr_number=$(cat pr_number/pr_number)
echo "pr-number=$pr_number" >> $GITHUB_OUTPUT

- name: Find Comment
uses: peter-evans/find-comment@v1
if: success()
id: fc
with:
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
body-includes: "<!-- __NEXTJS_BUNDLE -->"

- name: Create Comment
uses: peter-evans/[email protected]
if: success() && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
body: ${{ steps.get-comment-body.outputs.body }}

- name: Update Comment
uses: peter-evans/[email protected]
if: success() && steps.fc.outputs.comment-id != 0
- name: Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
body: ${{ steps.get-comment-body.outputs.body }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
header: next-bundle-analysis
number: ${{ steps.get-comment-body.outputs.pr-number }}
message: ${{ steps.get-comment-body.outputs.body }}
10 changes: 5 additions & 5 deletions .github/workflows/site_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
lint:
runs-on: ubuntu-latest

name: Lint on node 12.x and ubuntu-latest
name: Lint on node 20.x and ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Use Node.js 12.x
uses: actions/setup-node@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 20.x

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1.7.10
uses: bahmutov/npm-install@v1.8.32

- name: Lint codebase
run: yarn ci-check
12 changes: 3 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ const nextConfig = {
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
reactStrictMode: true,
experimental: {
plugins: true,
// TODO: Remove after https://github.com/vercel/next.js/issues/49355 is fixed
appDir: false,
scrollRestoration: true,
legacyBrowsers: false,
browsersListForSwc: true,
},
env: {
SANDPACK_BARE_COMPONENTS: process.env.SANDPACK_BARE_COMPONENTS,
},
env: {},
webpack: (config, {dev, isServer, ...options}) => {
if (process.env.ANALYZE) {
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
Expand All @@ -35,10 +33,6 @@ const nextConfig = {

const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
config.plugins.push(
new NormalModuleReplacementPlugin(
/^@stitches\/core$/,
require.resolve('./src/utils/emptyShim.js')
),
new NormalModuleReplacementPlugin(
/^raf$/,
require.resolve('./src/utils/rafShim.js')
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"check-all": "npm-run-all prettier lint:fix tsc"
},
"dependencies": {
"@codesandbox/sandpack-react": "1.15.5",
"@codesandbox/sandpack-react": "2.6.0",
"@docsearch/css": "3.0.0-alpha.41",
"@docsearch/react": "3.0.0-alpha.41",
"@headlessui/react": "^1.7.0",
Expand All @@ -32,12 +32,12 @@
"debounce": "^1.2.1",
"ga-lite": "^2.1.4",
"github-slugger": "^1.3.0",
"next": "12.3.2-canary.7",
"next": "^13.4.1",
"next-remote-watch": "^1.0.0",
"parse-numeric-range": "^1.2.0",
"react": "0.0.0-experimental-cb5084d1c-20220924",
"react-collapsed": "npm:@gaearon/[email protected]",
"react-dom": "0.0.0-experimental-cb5084d1c-20220924",
"react": "^0.0.0-experimental-16d053d59-20230506",
"react-collapsed": "4.0.4",
"react-dom": "^0.0.0-experimental-16d053d59-20230506",
"remark-frontmatter": "^4.0.1",
"remark-gfm": "^3.0.1"
},
Expand Down Expand Up @@ -92,13 +92,13 @@
"retext": "^7.0.1",
"retext-smartypants": "^4.0.0",
"rss": "^1.2.2",
"tailwindcss": "^3.0.22",
"tailwindcss": "^3.3.2",
"typescript": "^4.0.2",
"unist-util-visit": "^2.0.3",
"webpack-bundle-analyzer": "^4.5.0"
},
"engines": {
"node": ">=12.x"
"node": "^16.8.0 || ^18.0.0 || ^19.0.0 || ^20.0.0"
},
"nextBundleAnalysis": {
"budget": null,
Expand Down
30 changes: 0 additions & 30 deletions patches/@codemirror+lang-javascript+0.19.6.patch

This file was deleted.

62 changes: 0 additions & 62 deletions patches/@codesandbox+sandpack-react+1.15.5.patch

This file was deleted.

345 changes: 0 additions & 345 deletions patches/@lezer+javascript+0.15.2.patch

This file was deleted.

22 changes: 0 additions & 22 deletions patches/next+12.3.2-canary.7.patch

This file was deleted.

22 changes: 22 additions & 0 deletions patches/next+13.4.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/next/dist/server/render.js b/node_modules/next/dist/server/render.js
index a1f8648..1b3d608 100644
--- a/node_modules/next/dist/server/render.js
+++ b/node_modules/next/dist/server/render.js
@@ -758,9 +758,14 @@ async function renderToHTML(req, res, pathname, query, renderOpts) {
// Always using react concurrent rendering mode with required react version 18.x
const renderShell = async (EnhancedApp, EnhancedComponent)=>{
const content = renderContent(EnhancedApp, EnhancedComponent);
- return await (0, _nodewebstreamshelper.renderToInitialStream)({
- ReactDOMServer: _serverbrowser.default,
- element: content
+ return new Promise((resolve, reject) => {
+ (0, _nodewebstreamshelper.renderToInitialStream)({
+ ReactDOMServer: _serverbrowser.default,
+ element: content,
+ streamOptions: {
+ onError: reject
+ }
+ }).then(resolve, reject);
});
};
const createBodyResult = (0, _tracer.getTracer)().wrap(_constants2.RenderSpan.createBodyResult, (initialStream, suffix)=>{
Binary file removed public/images/team/dave-mccabe.jpg
Binary file not shown.
Binary file removed public/images/team/lunaruan.jpg
Binary file not shown.
Binary file removed public/images/team/mengdi-chen.jpg
Binary file not shown.
Binary file removed public/images/team/sean-keegan.jpg
Binary file not shown.
10 changes: 5 additions & 5 deletions src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ function Breadcrumbs({breadcrumbs}: {breadcrumbs: RouteItem[]}) {
!crumb.skipBreadcrumb && (
<div className="flex mb-3 mt-0.5 items-center" key={i}>
<Fragment key={crumb.path}>
<Link href={crumb.path}>
<a className="text-link dark:text-link-dark text-sm tracking-wide font-bold uppercase mr-1 hover:underline">
{crumb.title}
</a>
<Link
href={crumb.path}
className="text-link dark:text-link-dark text-sm tracking-wide font-bold uppercase me-1 hover:underline">
{crumb.title}
</Link>
<span className="inline-block mr-1 text-link dark:text-link-dark text-lg">
<span className="inline-block me-1 text-link dark:text-link-dark text-lg rtl:rotate-180">
<svg
width="20"
height="20"
Expand Down
13 changes: 8 additions & 5 deletions src/components/ButtonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ButtonLink({
label,
target = '_self',
...props
}: JSX.IntrinsicElements['a'] & ButtonLinkProps) {
}: React.AnchorHTMLAttributes<HTMLAnchorElement> & ButtonLinkProps) {
const classes = cn(
className,
'active:scale-[.98] transition-transform inline-flex font-bold items-center outline-none focus:outline-none focus-visible:outline focus-visible:outline-link focus:outline-offset-2 focus-visible:dark:focus:outline-link-dark leading-snug',
Expand All @@ -34,10 +34,13 @@ function ButtonLink({
}
);
return (
<NextLink href={href as string}>
<a className={classes} {...props} aria-label={label} target={target}>
{children}
</a>
<NextLink
href={href as string}
className={classes}
{...props}
aria-label={label}
target={target}>
{children}
</NextLink>
);
}
Expand Down
35 changes: 17 additions & 18 deletions src/components/DocsFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,24 @@ function FooterLink({
type: 'Previous' | 'Next';
}) {
return (
<NextLink href={href}>
<a
className={cn(
'flex gap-x-4 md:gap-x-6 items-center w-full md:w-80 px-4 md:px-5 py-6 border-2 border-transparent text-base leading-base text-link dark:text-link-dark rounded-lg group focus:text-link dark:focus:text-link-dark focus:bg-highlight focus:border-link dark:focus:bg-highlight-dark dark:focus:border-link-dark focus:border-opacity-100 focus:border-2 focus:ring-1 focus:ring-offset-4 focus:ring-blue-40 active:ring-0 active:ring-offset-0 hover:bg-gray-5 dark:hover:bg-gray-80',
{
'flex-row-reverse justify-self-end text-right': type === 'Next',
}
)}>
<IconNavArrow
className="text-tertiary dark:text-tertiary-dark inline group-focus:text-link dark:group-focus:text-link-dark"
displayDirection={type === 'Previous' ? 'left' : 'right'}
/>
<span>
<span className="block no-underline text-sm tracking-wide text-secondary dark:text-secondary-dark uppercase font-bold group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
{type}
</span>
<span className="block text-lg group-hover:underline">{title}</span>
<NextLink
href={href}
className={cn(
'flex gap-x-4 md:gap-x-6 items-center w-full md:w-80 px-4 md:px-5 py-6 border-2 border-transparent text-base leading-base text-link dark:text-link-dark rounded-lg group focus:text-link dark:focus:text-link-dark focus:bg-highlight focus:border-link dark:focus:bg-highlight-dark dark:focus:border-link-dark focus:border-opacity-100 focus:border-2 focus:ring-1 focus:ring-offset-4 focus:ring-blue-40 active:ring-0 active:ring-offset-0 hover:bg-gray-5 dark:hover:bg-gray-80',
{
'flex-row-reverse justify-self-end text-end': type === 'Next',
}
)}>
<IconNavArrow
className="text-tertiary dark:text-tertiary-dark inline group-focus:text-link dark:group-focus:text-link-dark"
displayDirection={type === 'Previous' ? 'start' : 'end'}
/>
<span>
<span className="block no-underline text-sm tracking-wide text-secondary dark:text-secondary-dark uppercase font-bold group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
{type}
</span>
</a>
<span className="block text-lg group-hover:underline">{title}</span>
</span>
</NextLink>
);
}
8 changes: 7 additions & 1 deletion src/components/Icon/IconArrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import cn from 'classnames';

export const IconArrow = memo<
JSX.IntrinsicElements['svg'] & {
displayDirection: 'left' | 'right' | 'up' | 'down';
/**
* The direction the arrow should point.
* `start` and `end` are relative to the current locale.
* for example, in LTR, `start` is left and `end` is right.
*/
displayDirection: 'start' | 'end' | 'right' | 'left' | 'up' | 'down';
}
>(function IconArrow({displayDirection, className, ...rest}) {
return (
Expand All @@ -20,6 +25,7 @@ export const IconArrow = memo<
{...rest}
className={cn(className, {
'rotate-180': displayDirection === 'right',
'rotate-180 rtl:rotate-0': displayDirection === 'end',
})}>
<path fill="none" d="M0 0h24v24H0z" />
<path d="M7.828 11H20v2H7.828l5.364 5.364-1.414 1.414L4 12l7.778-7.778 1.414 1.414z" />
Expand Down
8 changes: 7 additions & 1 deletion src/components/Icon/IconArrowSmall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ import cn from 'classnames';

export const IconArrowSmall = memo<
JSX.IntrinsicElements['svg'] & {
displayDirection: 'left' | 'right' | 'up' | 'down';
/**
* The direction the arrow should point.
* `start` and `end` are relative to the current locale.
* for example, in LTR, `start` is left and `end` is right.
*/
displayDirection: 'start' | 'end' | 'right' | 'left' | 'up' | 'down';
}
>(function IconArrowSmall({displayDirection, className, ...rest}) {
const classes = cn(className, {
'rotate-180': displayDirection === 'left',
'rotate-180 rtl:rotate-0': displayDirection === 'start',
'rotate-90': displayDirection === 'down',
});
return (
Expand Down
Loading
Loading