Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme-ui): move component to mui on EditorialContent #970

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Badge, Message } from "theme-ui";
import { useQuery } from "urql";
import { FixedSnackBar } from "./utils/SnackBar";
import React from "react";
import { Chip } from "@mui/material";

export const getRoleQuery = `
query getRoles{
Expand All @@ -16,16 +18,14 @@ export function Roles() {
if (fetching) return <p>loading</p>;
if (error)
return (
<Message>
<pre>{JSON.stringify(error, 0, 2)}</pre>
</Message>
<FixedSnackBar>
<pre>{JSON.stringify(error, null, 2)}</pre>
</FixedSnackBar>
);
return (
<p>
{data.roles.map(({ role }) => (
<Badge as="span" variant="dark" key={role}>
{role}
</Badge>
{data.roles.map((role: string) => (
<Chip color="success" key={role} label={role} />
))}
</p>
);
Expand Down
11 changes: 8 additions & 3 deletions targets/frontend/src/components/alerts/AlertTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Link from "next/link";
import PropTypes from "prop-types";
import { getStatusLabel, slugifyRepository } from "src/models";
import { Message, Spinner } from "theme-ui";
import { Spinner } from "theme-ui";
import { useQuery } from "urql";

import { TabItem, Tabs } from "../tabs";
import { FixedSnackBar } from "../utils/SnackBar";
import React from "react";

const countAlertByStatusQuery = `
query getAlerts($repository: String!) {
Expand Down Expand Up @@ -42,8 +44,11 @@ export function AlertTabs({
}

if (error) {
console.error(error);
return <Message>{error}</Message>;
return (
<FixedSnackBar>
<pre>{JSON.stringify(error, null, 2)}</pre>
</FixedSnackBar>
);
}

return (
Expand Down
42 changes: 20 additions & 22 deletions targets/frontend/src/components/contributions/answers/Answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,26 @@ export const ContributionsAnswer = ({
/>
</FormControl>
{answer && !isCodeDuTravail(answer) && (
<FormControl>
<FormRadioGroup
name="otherAnswer"
label="Type de réponse"
control={control}
disabled={isNotEditable(answer)}
options={[
{
label: "Afficher la réponse",
value: "ANSWER",
},
{
label: "La convention collective ne prévoit rien",
value: "NOTHING",
},
{
label: "Nous n'avons pas la réponse",
value: "UNKNOWN",
},
]}
/>
</FormControl>
<FormRadioGroup
name="otherAnswer"
label="Type de réponse"
control={control}
disabled={isNotEditable(answer)}
options={[
{
label: "Afficher la réponse",
value: "ANSWER",
},
{
label: "La convention collective ne prévoit rien",
value: "NOTHING",
},
{
label: "Nous n'avons pas la réponse",
value: "UNKNOWN",
},
]}
/>
)}
{answer && !isCodeDuTravail(answer) && (
<KaliReferenceInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SortableContainer } from "react-sortable-hoc";
import { Button } from "../button";
import { List } from "../list";
import { SortableSection } from "./Section";
import { Box } from "@mui/material";

const SortableSectionList = SortableContainer(
({ blocks, name, ...props }: any) => (
Expand Down Expand Up @@ -62,22 +63,26 @@ export function ContentSections({ name }: any) {
move(oldIndex, newIndex);
}}
/>
<Button
type="button"
size="small"
variant="secondary"
onClick={() => append({ blocks: [{ markdown: "", type: "markdown" }] })}
>
{/* todo refactor to a ButtonWithicon since sx props not working */}
<IoMdAdd
sx={{
height: "iconSmall",
mr: "xsmall",
width: "iconSmall",
}}
/>
Ajouter une section supplémentaire
</Button>
<Box sx={{ mt: "1rem" }}>
<Button
type="button"
size="small"
variant="secondary"
onClick={() =>
append({ blocks: [{ markdown: "", type: "markdown" }] })
}
>
{/* todo refactor to a ButtonWithicon since sx props not working */}
<IoMdAdd
sx={{
height: "iconSmall",
mr: "xsmall",
width: "iconSmall",
}}
/>
Ajouter une section
</Button>
</Box>
</div>
);
}
Loading
Loading