Skip to content

Commit

Permalink
refactor: Layout direction js to tsx (#17853)
Browse files Browse the repository at this point in the history
* refactor: layout direction js to tsx

* refactor: added the required stuff

---------

Co-authored-by: Nikhil Tomar <[email protected]>
Co-authored-by: Taylor Jones <[email protected]>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent 4b77a2a commit cdc8db7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,37 @@
*/

import PropTypes from 'prop-types';
import React from 'react';
import React, { ElementType, ReactNode } from 'react';
import { LayoutDirectionContext } from './LayoutDirectionContext';

type Direction = 'ltr' | 'rtl';

interface LayoutDirectionContextValue {
direction: Direction;
}

interface LayoutDirectionProps {
/**
* Customize the element type used to render the outermost node
*/
as?: ElementType;
/**
* Provide child elements or components to be rendered inside of this
* component
*/
children?: ReactNode;
/**
* Specify the layout direction of this part of the page
*/
dir: Direction;
}

function LayoutDirection({
as: BaseComponent = 'div',
children,
dir,
...rest
}) {
}: LayoutDirectionProps) {
const value = React.useMemo(() => {
return {
direction: dir,
Expand Down

0 comments on commit cdc8db7

Please sign in to comment.