Skip to content

Commit

Permalink
Change Sheet default export to named export
Browse files Browse the repository at this point in the history
  • Loading branch information
Temzasse committed Oct 8, 2023
1 parent 8a3db2e commit 473f72d
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ npm install framer-motion
## Usage

```jsx
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';
import { useState } from 'react';

function Example() {
Expand Down Expand Up @@ -98,7 +98,7 @@ Also, by constructing the sheet from smaller pieces makes it easier to apply any
Imperative method that can be accessed via a ref for snapping to a snap point in given index.

```tsx
import Sheet, { SheetRef } from 'react-modal-sheet';
import { Sheet, SheetRef } from 'react-modal-sheet';
import { useState, useRef } from 'react';

function Example() {
Expand Down Expand Up @@ -144,7 +144,7 @@ Similarly to the `snapTo` method the `y` value can be accessed via a ref.
The `y` value can be useful for certain situtation eg. when you want to combine snap points with scrollable sheet content and ensure that the content stays properly scrollable in any snap point. Below you can see a simplified example of this situation and for a more detailed example take a look at the [ScrollableSnapPoints](example/components/ScrollableSnapPoints.tsx) component in the example app.

```tsx
import Sheet, { SheetRef } from 'react-modal-sheet';
import { Sheet, SheetRef } from 'react-modal-sheet';
import { useState, useRef } from 'react';

function Example() {
Expand Down Expand Up @@ -371,7 +371,7 @@ You can add your own styles or override the default sheet styles via the exposed
#### CSS-in-JS

```jsx
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';
import styled from 'styled-components';
import { useState } from 'react';

Expand Down Expand Up @@ -421,7 +421,7 @@ The example below utilizes React Aria to achieve an accessible modal-like bottom
> ℹ️ The example was built by following the React Aria's [useDialog](https://react-spectrum.adobe.com/react-aria/useDialog.html) documentation.
```jsx
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';
import { useRef } from 'react';
import { useOverlayTriggerState } from 'react-stately';

Expand Down
4 changes: 2 additions & 2 deletions example/components/ContentHeight.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet, { SheetRef } from 'react-modal-sheet';
import { Sheet, SheetRef } from 'react-modal-sheet';

import { Button } from './common';

Expand Down Expand Up @@ -36,7 +36,7 @@ const ContentHeight = () => {
{boxes.map((_, i) => (
<Box
key={i}
onClick={() => setBoxes(prev => [...prev, i + 1])}
onClick={() => setBoxes((prev) => [...prev, i + 1])}
>
{i} (click to create new boxes )
</Box>
Expand Down
2 changes: 1 addition & 1 deletion example/components/DisableDrag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

import { Button } from './common';

Expand Down
2 changes: 1 addition & 1 deletion example/components/Scrollable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

import { Button } from './common';

Expand Down
2 changes: 1 addition & 1 deletion example/components/SnapPoints.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet, { SheetRef } from 'react-modal-sheet';
import { Sheet, SheetRef } from 'react-modal-sheet';

import { Button } from './common';
import { useMetaThemeColor } from './hooks';
Expand Down
2 changes: 1 addition & 1 deletion example/components/a11y/A11ySheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { OverlayTriggerState } from 'react-stately';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

import {
FocusScope,
Expand Down
2 changes: 1 addition & 1 deletion example/components/apple-music/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

import { useMetaThemeColor } from '../hooks';
import { album } from './data';
Expand Down
2 changes: 1 addition & 1 deletion example/components/slack-message/NewMessageContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

const people = [
'john',
Expand Down
2 changes: 1 addition & 1 deletion example/components/slack-message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import styled from 'styled-components';
import { FiEdit as MessageIcon, FiSearch as SearchIcon } from 'react-icons/fi';
import { useOverlayTriggerState } from 'react-stately';
import Sheet from 'react-modal-sheet';
import { Sheet } from 'react-modal-sheet';

import {
useOverlay,
Expand Down
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type MotionValue } from 'framer-motion';

import Sheet from './sheet';
import _Sheet from './sheet';
import SheetContainer from './SheetContainer';
import SheetContent from './SheetContent';
import SheetHeader from './SheetHeader';
Expand All @@ -14,11 +14,11 @@ export interface SheetRef {
}

// HACK: this is needed to get the typing to work properly...
const _SheetCompound: any = Sheet;
const _SheetCompound: any = _Sheet;
_SheetCompound.Container = SheetContainer;
_SheetCompound.Header = SheetHeader;
_SheetCompound.Content = SheetContent;
_SheetCompound.Backdrop = SheetBackdrop;
_SheetCompound.Scroller = SheetScroller;

export default _SheetCompound as SheetCompound;
export const Sheet = _SheetCompound as SheetCompound;

0 comments on commit 473f72d

Please sign in to comment.