Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bb62d8

Browse files
authored
Merge pull request#190 from yourssu/develop
release 2.3.2
2 parentsf64f19a +dd6bf37 commit4bb62d8

File tree

3 files changed

+5
-25
lines changed

3 files changed

+5
-25
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name":"@yourssu/design-system-react",
33
"packageManager":"pnpm@9.15.2",
44
"private":false,
5-
"version":"2.3.1",
5+
"version":"2.3.2",
66
"description":"Yourssu Design System for React",
77
"keywords": [
88
"yourssu",

‎src/components/Tabs/Tab.context.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎src/components/Tabs/hooks/useTabs.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import{Children,isValidElement,useContext,useRef,useState,useTransition}from'react';
1+
import{Children,isValidElement,useRef,useState,useTransition}from'react';
22

3-
import{TabContext}from'../Tab.context';
43
import{StyledFixedTab,StyledList,StyledScrollableTab}from'../Tabs.style';
54
import{TabListProps,TabPanelProps,TabProps}from'../Tabs.type';
65

@@ -12,15 +11,10 @@ export const useTabs = <TabType extends string>({
1211
scrollable?:boolean;
1312
})=>{
1413
const[isPending,startTransition]=useTransition();
14+
const[currentTab,setCurrentTab]=useState<TabType>(defaultTab);
1515

1616
constTabs=({ children}:{children:React.ReactNode})=>{
17-
const[currentTab,setCurrentTab]=useState<string>(defaultTab);
18-
19-
return(
20-
<TabContext.Providervalue={{ currentTab, setCurrentTab}}>
21-
<div>{children}</div>
22-
</TabContext.Provider>
23-
);
17+
return<div>{children}</div>;
2418
};
2519

2620
constList=({ children, size='large', ...props}:TabListProps)=>{
@@ -44,16 +38,11 @@ export const useTabs = <TabType extends string>({
4438
};
4539

4640
constTab=({ children, id, onClick, ...props}:TabProps<TabType>)=>{
47-
const{ currentTab, setCurrentTab}=useContext(TabContext)??{
48-
currentTab:undefined,
49-
setCurrentTab:undefined,
50-
startTransition:undefined,
51-
};
5241
constisSelected=currentTab===id;
5342
consttabRef=useRef<HTMLButtonElement>(null);
5443

5544
constonClickWrapper=(event:React.MouseEvent<HTMLButtonElement,MouseEvent>)=>{
56-
startTransition(()=>setCurrentTab?.(id));
45+
startTransition?.(()=>setCurrentTab?.(id));
5746
onClick?.(event);
5847
};
5948

@@ -113,8 +102,6 @@ export const useTabs = <TabType extends string>({
113102
};
114103

115104
constPanel=({ children, value, ...props}:TabPanelProps<TabType>)=>{
116-
const{ currentTab}=useContext(TabContext)??{currentTab:undefined};
117-
118105
if(currentTab!==value)return;
119106
return(
120107
<divrole="tabpanel"aria-labelledby={value}tabIndex={0}{...props}>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp