Skip to content

Commit 7d31945

Browse files
committed
use current chakra ui component format
1 parent 0ba5c08 commit 7d31945

24 files changed

+568
-1160
lines changed

src/components/ActivityButtons.tsx

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,17 @@ import {
1010
Text,
1111
createListCollection,
1212
parseColor,
13+
ColorPicker,
14+
Select,
15+
Portal,
1316
} from "@chakra-ui/react";
1417
import type { ComponentPropsWithoutRef, FormEvent } from "react";
1518
import { useContext, useLayoutEffect, useState } from "react";
1619

1720
import { LuCheck as CheckIcon, LuX as CloseIcon } from "react-icons/lu";
1821
import { Checkbox } from "./ui/checkbox";
19-
import {
20-
ColorPickerArea,
21-
ColorPickerChannelSlider,
22-
ColorPickerContent,
23-
ColorPickerControl,
24-
ColorPickerEyeDropper,
25-
ColorPickerInput,
26-
ColorPickerRoot,
27-
ColorPickerTrigger,
28-
} from "./ui/color-picker";
2922
import { Field } from "./ui/field";
3023
import { Radio, RadioGroup } from "./ui/radio";
31-
import {
32-
SelectContent,
33-
SelectItem,
34-
SelectRoot,
35-
SelectTrigger,
36-
SelectValueText,
37-
} from "./ui/select";
3824

3925
import type { Activity, NonClass } from "../lib/activity";
4026
import { Timeslot } from "../lib/activity";
@@ -219,24 +205,29 @@ function ActivityColor(props: { activity: Activity; onHide: () => void }) {
219205
return (
220206
<Flex gap={2}>
221207
<Flex direction="row" gap={2}>
222-
<ColorPickerRoot
208+
<ColorPicker.Root
223209
value={color}
224210
onValueChange={(e) => {
225211
setColor(e.value);
226212
}}
227213
>
228-
<ColorPickerControl>
229-
<ColorPickerInput autoFocus />
230-
<ColorPickerTrigger />
231-
</ColorPickerControl>
232-
<ColorPickerContent>
233-
<ColorPickerArea />
234-
<HStack>
235-
<ColorPickerEyeDropper />
236-
<ColorPickerChannelSlider channel="hue" />
237-
</HStack>
238-
</ColorPickerContent>
239-
</ColorPickerRoot>
214+
<ColorPicker.HiddenInput />
215+
<ColorPicker.Control>
216+
<ColorPicker.Input autoFocus />
217+
<ColorPicker.Trigger />
218+
</ColorPicker.Control>
219+
<Portal>
220+
<ColorPicker.Positioner>
221+
<ColorPicker.Content>
222+
<ColorPicker.Area />
223+
<HStack>
224+
<ColorPicker.EyeDropper />
225+
<ColorPicker.ChannelSlider channel="hue" />
226+
</HStack>
227+
</ColorPicker.Content>
228+
</ColorPicker.Positioner>
229+
</Portal>
230+
</ColorPicker.Root>
240231
<ButtonGroup>
241232
<Button onClick={onReset}>Reset</Button>
242233
<Button onClick={onCancel}>Cancel</Button>
@@ -347,7 +338,7 @@ function NonClassAddTime(props: { activity: NonClass }) {
347338
});
348339

349340
const renderTimeDropdown = (key: "start" | "end") => (
350-
<SelectRoot
341+
<Select.Root
351342
collection={timesCollection}
352343
size="sm"
353344
width="8rem"
@@ -356,17 +347,28 @@ function NonClassAddTime(props: { activity: NonClass }) {
356347
setTimes({ ...times, [key]: e.value[0] });
357348
}}
358349
>
359-
<SelectTrigger>
360-
<SelectValueText />
361-
</SelectTrigger>
362-
<SelectContent>
363-
{timesCollection.items.map((time) => (
364-
<SelectItem item={time} key={time}>
365-
{time}
366-
</SelectItem>
367-
))}
368-
</SelectContent>
369-
</SelectRoot>
350+
<Select.HiddenSelect />
351+
<Select.Control>
352+
<Select.Trigger>
353+
<Select.ValueText />
354+
</Select.Trigger>
355+
<Select.IndicatorGroup>
356+
<Select.Indicator />
357+
</Select.IndicatorGroup>
358+
</Select.Control>
359+
<Portal>
360+
<Select.Positioner>
361+
<Select.Content>
362+
{timesCollection.items.map((time) => (
363+
<Select.Item item={time} key={time}>
364+
{time}
365+
<Select.ItemIndicator />
366+
</Select.Item>
367+
))}
368+
</Select.Content>
369+
</Select.Positioner>
370+
</Portal>
371+
</Select.Root>
370372
);
371373

372374
return (

src/components/ClassTable.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ import {
2323
type Module,
2424
} from "ag-grid-community";
2525

26-
import { Box, Flex, Image, Input, Button, ButtonGroup } from "@chakra-ui/react";
26+
import {
27+
Box,
28+
Flex,
29+
Image,
30+
Input,
31+
Button,
32+
ButtonGroup,
33+
InputGroup,
34+
} from "@chakra-ui/react";
2735
import { LuPlus, LuMinus, LuSearch, LuStar } from "react-icons/lu";
28-
import { InputGroup } from "./ui/input-group";
2936
import { LabelledButton } from "./ui/button";
3037
import { useColorMode } from "./ui/color-mode";
3138

src/components/FeedbackBanner.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import {
88
Float,
99
Presence,
1010
CloseButton,
11+
Button,
1112
} from "@chakra-ui/react";
12-
import { LinkButton } from "./ui/link-button";
1313

1414
import { HydrantContext } from "../lib/hydrant";
15+
import { Link } from "react-router";
1516

1617
export const FeedbackBanner = () => {
1718
const { state } = useContext(HydrantContext);
@@ -40,20 +41,20 @@ export const FeedbackBanner = () => {
4041
<Text fontWeight="medium" maxW={{ base: "32ch", md: "unset" }}>
4142
Do you have feedback on Hydrant? We'd love to hear it!
4243
</Text>
43-
<LinkButton
44+
<Button
4445
flexShrink={0}
4546
variant="plain"
46-
href={"mailto:sipb-hydrant@mit.edu"}
4747
ms="6"
4848
bg="blackAlpha.300"
4949
color="whiteAlpha.900"
5050
fontWeight="semibold"
5151
px="3"
5252
py="1"
5353
height="inherit"
54+
asChild
5455
>
55-
Contact us
56-
</LinkButton>
56+
<Link to={"mailto:sipb-hydrant@mit.edu"}>Contact us</Link>
57+
</Button>
5758
<CloseButton
5859
hideFrom="sm"
5960
variant="ghost"

0 commit comments

Comments
 (0)