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

Tooltip + repositioning of StatusButton #186

Merged
merged 1 commit into from
May 22, 2024
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
7 changes: 5 additions & 2 deletions frontend/app/[locale]/components/StatusButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ function StatusButton(
<Button
variant="contained"
onClick={handleClick}
style={{
sx={{
border: 'none',
backgroundColor: 'transparent',
margin: 10,
minWidth: '30px', // Ensure the button is square by setting equal width and height
minHeight: '30px', // Adjust the size as needed
padding: 0,
margin: 1,
}}
>
{statuses[statusIndex].icon}
Expand Down
11 changes: 9 additions & 2 deletions frontend/app/[locale]/components/general/RequiredFilesList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client"

import {Button, IconButton, List, ListItem, ListItemText, TextField, Typography} from "@mui/material";
import {Button, IconButton, List, ListItem, ListItemText, Tooltip, TextField, Typography} from "@mui/material";
import DeleteIcon from "@mui/icons-material/Delete";
import React, {useState} from "react";
import Box from "@mui/material/Box";
import StatusButton from "@app/[locale]/components/StatusButton";
import {useTranslation} from "react-i18next";

interface ItemsListProps {
items: string[],
Expand All @@ -27,6 +28,7 @@ const ItemsList = ({
}: ItemsListProps) => {
const [newItem, setNewItem] = useState('')
const [noInput, setNoInput] = useState(false)
const {t} = useTranslation();

const handleDelete = (index: number) => {
const newFields = [...items];
Expand Down Expand Up @@ -66,10 +68,10 @@ const ItemsList = ({
>
{items.map((field, index) => (
<ListItem
disablePadding={true}
key={index}
secondaryAction={
<div>
<StatusButton files={items_status} setFiles={setItemsStatus} fileIndex={index}/>
<IconButton
edge="end"
aria-label="delete"
Expand All @@ -80,6 +82,11 @@ const ItemsList = ({
</div>
}
>
<Tooltip title={t("status_button_tooltip")} placement="top">
<div style={{ display: 'flex', alignItems: 'center' }}>
<StatusButton files={items_status} setFiles={setItemsStatus} fileIndex={index} />
</div>
</Tooltip>
<ListItemText
primary={field}
/>
Expand Down
3 changes: 2 additions & 1 deletion frontend/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@
"join/leave": "Join/Leave",
"group_nr": "Group nr",
"join_leave": "Join/Leave",
"not_in_group": "Join a group to submit"
"not_in_group": "Join a group to submit",
"status_button_tooltip": "Required, optional or forbidden file"
}
3 changes: 2 additions & 1 deletion frontend/locales/nl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,6 @@
"join/leave": "Toetreden/Verlaten",
"group_nr": "Groep nr",
"join_leave": "Toetreden/Verlaten",
"not_in_group": "Je kan niet indienen zonder in een groep te zitten"
"not_in_group": "Je kan niet indienen zonder in een groep te zitten",
"status_button_tooltip": "Verplicht, optioneel of verboden bestand"
}
Loading