-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pull to refresh to registry
- Loading branch information
Showing
14 changed files
with
229 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"use client"; | ||
|
||
import { AppBar, AppScreen } from "@seed-design/stackflow"; | ||
import { ActivityComponentType } from "@stackflow/react/future"; | ||
import { Stack } from "seed-design/ui/layout"; | ||
import { | ||
PullToRefreshContent, | ||
PullToRefreshIndicator, | ||
PullToRefreshRoot, | ||
} from "seed-design/ui/pull-to-refresh"; | ||
|
||
declare module "@stackflow/config" { | ||
interface Register { | ||
"pull-to-refresh-preview": unknown; | ||
} | ||
} | ||
|
||
const PullToRefreshPreview: ActivityComponentType<"pull-to-refresh-preview"> = () => { | ||
// AppScreen is imported from @seed-design/stackflow instead of snippet for demo purpose. | ||
// AppScreen snippet is integrating PullToRefresh, so it's not necessary to use it here. | ||
return ( | ||
<AppScreen.Root> | ||
<AppBar.Root divider> | ||
<AppBar.Main> | ||
<AppBar.Title>Pull To Refresh</AppBar.Title> | ||
</AppBar.Main> | ||
</AppBar.Root> | ||
<PullToRefreshRoot | ||
asChild | ||
onPtrReady={() => {}} | ||
onPtrRefresh={async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
}} | ||
> | ||
<AppScreen.Layer> | ||
<PullToRefreshIndicator /> | ||
<PullToRefreshContent asChild> | ||
<Stack paddingX="spacingX.globalGutter"> | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam autem deserunt | ||
reprehenderit ducimus sunt. Quod laudantium excepturi tempora fuga repellendus | ||
accusantium nam maiores? Quas debitis, neque ullam eligendi minus sit? | ||
</Stack> | ||
</PullToRefreshContent> | ||
</AppScreen.Layer> | ||
</PullToRefreshRoot> | ||
</AppScreen.Root> | ||
); | ||
}; | ||
|
||
export default PullToRefreshPreview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import { ActivityComponentType } from "@stackflow/react/future"; | ||
import { AppBar, AppBarMain } from "seed-design/ui/app-bar"; | ||
import { AppScreen, AppScreenContent } from "seed-design/ui/app-screen"; | ||
import { Stack } from "seed-design/ui/layout"; | ||
import { | ||
PullToRefreshContent, | ||
PullToRefreshIndicator, | ||
PullToRefreshRoot, | ||
} from "seed-design/ui/pull-to-refresh"; | ||
import { TabsContent, TabsTrigger, TabsList, TabsRoot } from "seed-design/ui/tabs"; | ||
|
||
declare module "@stackflow/config" { | ||
interface Register { | ||
"pull-to-refresh-tabs": unknown; | ||
} | ||
} | ||
|
||
const PullToRefreshTabs: ActivityComponentType<"pull-to-refresh-tabs"> = () => { | ||
return ( | ||
<AppScreen> | ||
<AppBar> | ||
<AppBarMain>Pull To Refresh</AppBarMain> | ||
</AppBar> | ||
<AppScreenContent> | ||
<TabsRoot defaultValue="1" contentLayout="fill"> | ||
<TabsList> | ||
<TabsTrigger value="1">Tab 1</TabsTrigger> | ||
<TabsTrigger value="2">Tab 2</TabsTrigger> | ||
</TabsList> | ||
<TabsContent value="1"> | ||
<PullToRefreshRoot | ||
onPtrReady={() => {}} | ||
onPtrRefresh={async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
}} | ||
> | ||
<PullToRefreshIndicator /> | ||
<PullToRefreshContent asChild> | ||
<Stack paddingX="spacingX.globalGutter"> | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam autem deserunt | ||
reprehenderit ducimus sunt. Quod laudantium excepturi tempora fuga repellendus | ||
accusantium nam maiores? Quas debitis, neque ullam eligendi minus sit? | ||
</Stack> | ||
</PullToRefreshContent> | ||
</PullToRefreshRoot> | ||
</TabsContent> | ||
<TabsContent value="2"> | ||
<Stack paddingX="spacingX.globalGutter">PTR is not available in this tab.</Stack> | ||
</TabsContent> | ||
</TabsRoot> | ||
</AppScreenContent> | ||
</AppScreen> | ||
); | ||
}; | ||
|
||
export default PullToRefreshTabs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: Pull To Refresh | ||
description: "이 문서는 정리 중이에요. 문의 내용은 #_design_core 채널을 찾아주세요." | ||
--- | ||
|
||
<StackflowExample names={["pull-to-refresh-preview"]} /> | ||
|
||
## Installation | ||
|
||
<Installation name="pull-to-refresh" /> | ||
|
||
## Props | ||
|
||
### PullToRefreshRoot | ||
|
||
<ReactTypeTable path="./registry/ui/pull-to-refresh.tsx" name="PullToRefreshRootProps" /> | ||
|
||
### PullToRefreshIndicator | ||
|
||
<ReactTypeTable path="./registry/ui/pull-to-refresh.tsx" name="PullToRefreshIndicatorProps" /> | ||
|
||
### PullToRefreshContent | ||
|
||
<ReactTypeTable path="./registry/ui/pull-to-refresh.tsx" name="PullToRefreshContentProps" /> | ||
|
||
## Examples | ||
|
||
### PTR in Tabs | ||
|
||
<StackflowExample names={["pull-to-refresh-tabs"]} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "pull-to-refresh", | ||
"dependencies": [ | ||
"@seed-design/react" | ||
], | ||
"innerDependencies": [ | ||
"ui:progress-circle" | ||
], | ||
"registries": [ | ||
{ | ||
"name": "pull-to-refresh.tsx", | ||
"type": "ui", | ||
"content": "\"use client\";\n\nimport { PullToRefresh } from \"@seed-design/react\";\nimport { forwardRef } from \"react\";\nimport { ProgressCircle } from \"./progress-circle\";\n\nexport interface PullToRefreshRootProps extends PullToRefresh.RootProps {}\n\nexport const PullToRefreshRoot = PullToRefresh.Root;\n\nexport interface PullToRefreshIndicatorProps\n extends Omit<PullToRefresh.IndicatorProps, \"children\"> {}\n\nexport const PullToRefreshIndicator = forwardRef<\n HTMLDivElement,\n PullToRefreshIndicatorProps\n>(({ ...otherProps }, ref) => {\n return (\n <PullToRefresh.Indicator ref={ref} {...otherProps}>\n {(props) => <ProgressCircle size=\"24\" tone=\"brand\" {...props} />}\n </PullToRefresh.Indicator>\n );\n});\n\nexport interface PullToRefreshContentProps extends PullToRefresh.ContentProps {}\n\nexport const PullToRefreshContent = PullToRefresh.Content;\n" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.