Skip to content

Commit 075381d

Browse files
Tabs cleanup
Former-commit-id: fcbe805
1 parent fc29987 commit 075381d

File tree

2 files changed

+7
-120
lines changed

2 files changed

+7
-120
lines changed

components/utilities/versionSelector.js

Lines changed: 1 addition & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
useVersion,
1313
DEFAULT_PLATFORM,
1414
getBestNumericVersion,
15-
versionAndPlatformAreCompatible,
1615
} from "../../context/VersionContext";
1716

1817
const VERSIONS_LIST = publicRuntimeConfig.VERSIONS_LIST;
@@ -36,32 +35,6 @@ const VersionSelector = ({
3635
);
3736

3837
const [widgetPlatform, setWidgetPlatform] = useState(compatiblePlatform);
39-
40-
// const handleSelectPlatform = useCallback(
41-
// (selectedPlatform) => {
42-
// if (
43-
// selectedPlatform != platformContext &&
44-
// versionAndPlatformAreCompatible(
45-
// // versionContext can be DEFAULT_VERSION (null) or "1.40.0" (even if that's the latest).
46-
// versionContext,
47-
// selectedPlatform,
48-
// )
49-
// ) {
50-
// // Navigate to new version and platform.
51-
// setVersionAndPlatform({
52-
// newVersion: versionContext,
53-
// newPlatform: selectedPlatform,
54-
// functionName: functionObject ? functionObject.name : "",
55-
// });
56-
// } else {
57-
// // Just set the widget to the selected platform but dont navigate anywhere.
58-
// // The user should pick a version first.
59-
// setWidgetPlatform(selectedPlatform);
60-
// }
61-
// },
62-
// [functionObject],
63-
// );
64-
6538
const handleSelectPlatform = useCallback(
6639
(selectedPlatform) => {
6740
setWidgetPlatform(selectedPlatform);
@@ -127,7 +100,7 @@ const VersionSelector = ({
127100
<RadioGroup.Root
128101
className={styles.VersionListRoot}
129102
defaultValue={
130-
availablePlatform == widgetPlatform
103+
availablePlatform == platformContext
131104
? numericVersion
132105
: null
133106
}
@@ -170,87 +143,10 @@ const VersionSelector = ({
170143
</ScrollArea.Root>
171144
</Tabs.Content>
172145
))}
173-
{/* <Tabs.Content className="TabsContent" value="oss">
174-
<form>
175-
<legend>Show exceptions for:</legend>
176-
<RadioGroup.Root
177-
className={styles.RadioGroupRoot}
178-
defaultValue={widgetPlatform}
179-
aria-label="streamlit platform"
180-
onValueChange={handleSelectPlatform}
181-
>
182-
{Object.keys(PLATFORMS).map((platform) => (
183-
<div key={platform}>
184-
<RadioGroup.Item
185-
className={styles.RadioGroupItem}
186-
value={platform}
187-
id={platform}
188-
>
189-
<RadioGroup.Indicator
190-
className={styles.RadioGroupIndicator}
191-
/>
192-
</RadioGroup.Item>
193-
<label className={styles.RadioLabel} htmlFor={platform}>
194-
{PLATFORMS[platform]}
195-
</label>
196-
</div>
197-
))}
198-
</RadioGroup.Root>
199-
</form>
200-
</Tabs.Content>
201-
<Tabs.Content className="TabsContent" value="sis"> */}
202-
{/* <ScrollArea.Root className={styles.ScrollAreaRoot}>
203-
<div className={styles.FadeTop}></div>
204-
<ScrollArea.Viewport className={styles.ScrollAreaViewport}>
205-
<RadioGroup.Root
206-
className={styles.VersionListRoot}
207-
defaultValue={numericVersion}
208-
aria-label="streamlit version"
209-
onValueChange={handleSelectVersion}
210-
>
211-
{validVersionForWidgetPlatform
212-
.toReversed()
213-
.map((validVersion) => (
214-
<div key={validVersion}>
215-
<RadioGroup.Item
216-
className={styles.VersionListItem}
217-
value={validVersion}
218-
id={validVersion}
219-
>
220-
<RadioGroup.Indicator
221-
className={classNames(
222-
"material-icons-sharp",
223-
styles.VersionListIndicator,
224-
)}
225-
/>
226-
</RadioGroup.Item>
227-
<label
228-
className={styles.VersionLabel}
229-
htmlFor={validVersion}
230-
>
231-
Version {validVersion}
232-
</label>
233-
</div>
234-
))}
235-
</RadioGroup.Root>
236-
</ScrollArea.Viewport>
237-
<div className={styles.FadeBottom}></div>
238-
<ScrollArea.Scrollbar
239-
className={styles.ScrollAreaScrollbar}
240-
orientation="vertical"
241-
>
242-
<ScrollArea.Thumb className={styles.ScrollAreaThumb} />
243-
</ScrollArea.Scrollbar>
244-
</ScrollArea.Root> */}
245-
{/* </Tabs.Content>
246-
<Tabs.Content className="TabsContent" value="na">
247-
<p>Test</p>
248-
</Tabs.Content> */}
249146
</Tabs.Root>
250147
<Popover.Close className={styles.PopoverClose} aria-label="Close">
251148
<i className="material-icons-sharp">close</i>
252149
</Popover.Close>
253-
<Popover.Arrow className={styles.PopoverArrow} />
254150
</Popover.Content>
255151
</Popover.Portal>
256152
</Popover.Root>

components/utilities/versionSelector.module.css

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
.PopoverContent legend {
88
@apply text-sm tracking-tight;
99
}
10-
.PopoverArrow {
11-
@apply fill-gray-20;
12-
}
13-
:global(.dark) .PopoverArrow {
14-
@apply fill-gray-90;
15-
}
1610
.PopoverClose {
1711
@apply h-6 w-6 absolute top-1.5 right-1.5;
1812
}
@@ -90,13 +84,13 @@
9084
@apply bg-gradient-to-b from-white to-transparent h-8 -mb-8 mr-3 relative z-auto;
9185
}
9286
:global(.dark) .FadeTop {
93-
@apply bg-gradient-to-b from-gray-80 to-transparent;
87+
@apply bg-gradient-to-b from-gray-90 to-transparent;
9488
}
9589
.FadeBottom {
9690
@apply bg-gradient-to-t from-white to-transparent h-8 -mt-8 mr-3 relative z-auto;
9791
}
9892
:global(.dark) .FadeBottom {
99-
@apply bg-gradient-to-t from-gray-80 to-transparent;
93+
@apply bg-gradient-to-t from-gray-90 to-transparent;
10094
}
10195

10296
/* List of versions within the scroll area*/
@@ -120,9 +114,6 @@
120114
.VersionLabel {
121115
@apply tracking-tight text-base pl-2 font-mono select-none;
122116
}
123-
/* :global(.dark) .VersionLabel {
124-
@apply text-gray-80;
125-
} */
126117
.VersionLabel:hover {
127118
@apply opacity-70 cursor-pointer;
128119
}
@@ -132,15 +123,15 @@
132123
}
133124

134125
.TabsList {
135-
@apply flex flex-col shrink-0 border-r border-gray-40 text-start;
126+
@apply flex flex-col shrink-0 border-r border-gray-40;
136127
}
137128

138129
.TabsTitle {
139130
@apply py-2 pl-4 text-sm mb-0;
140131
}
141132

142133
.TabsTrigger {
143-
@apply shrink-0 grow-0 h-14 px-4 select-none;
134+
@apply shrink-0 grow-0 h-14 px-4 select-none text-left;
144135
}
145136
.TabsTrigger:hover {
146137
@apply text-indigo-70;
@@ -153,10 +144,10 @@
153144
}
154145

155146
.TabsContent {
156-
@apply pl-2 bg-white;
147+
@apply pl-2 bg-white rounded-r-md;
157148
flex-grow: 1;
158149
outline: none;
159150
}
160151
:global(.dark) .TabsContent {
161-
@apply bg-gray-80;
152+
@apply bg-gray-90;
162153
}

0 commit comments

Comments
 (0)