feat(@ui): migrate checkbox component

This commit is contained in:
Paul Makles
2022-05-29 16:34:54 +01:00
parent 52ad0b2095
commit 0fbbde0acb
18 changed files with 239 additions and 361 deletions

View File

@@ -6,13 +6,11 @@ import styled from "styled-components/macro";
import { Text } from "preact-i18n";
import { useState } from "preact/hooks";
import { Button } from "@revoltchat/ui";
import { Button, Checkbox } from "@revoltchat/ui";
import { useApplicationState } from "../../mobx/State";
import { SECTION_NSFW } from "../../mobx/stores/Layout";
import Checkbox from "../ui/Checkbox";
import { Children } from "../../types/Preact";
const Base = styled.div`
@@ -81,10 +79,10 @@ export default observer((props: Props) => {
</span>
<Checkbox
checked={layout.getSectionState(SECTION_NSFW, false)}
onChange={() => layout.toggleSectionState(SECTION_NSFW, false)}>
<Text id="app.main.channel.nsfw.confirm" />
</Checkbox>
title={<Text id="app.main.channel.nsfw.confirm" />}
value={layout.getSectionState(SECTION_NSFW, false)}
onChange={() => layout.toggleSectionState(SECTION_NSFW, false)}
/>
<div className="actions">
<Button palette="secondary" onClick={() => history.goBack()}>
<Text id="app.special.modals.actions.back" />

View File

@@ -1,11 +1,11 @@
import { User } from "revolt.js";
import Checkbox, { CheckboxProps } from "../../ui/Checkbox";
import { Checkbox } from "@revoltchat/ui";
import UserIcon from "./UserIcon";
import { Username } from "./UserShort";
type UserProps = Omit<CheckboxProps, "children"> & { user: User };
type UserProps = { value: boolean; onChange: (v: boolean) => void; user: User };
export default function UserCheckbox({ user, ...props }: UserProps) {
return (