Fix styling for overflowing elements

This commit is contained in:
1ilit 2024-05-17 03:45:42 +03:00
parent 6c6d326544
commit cd050a59f9
7 changed files with 55 additions and 70 deletions

View File

@ -333,6 +333,7 @@ export default function Modal({
}} }}
cancelText={t("cancel")} cancelText={t("cancel")}
width={modal === MODAL.NEW ? 740 : 600} width={modal === MODAL.NEW ? 740 : 600}
bodyStyle={{ maxHeight: window.innerHeight - 280, overflow: "auto" }}
> >
{getModalBody()} {getModalBody()}
</SemiUIModal> </SemiUIModal>

View File

@ -10,7 +10,7 @@ export default function New({ selectedTemplateId, setSelectedTemplateId }) {
const templates = useLiveQuery(() => db.templates.toArray()); const templates = useLiveQuery(() => db.templates.toArray());
return ( return (
<div className="h-[360px] grid grid-cols-3 gap-2 overflow-auto px-1"> <div className="grid grid-cols-3 gap-2 overflow-auto px-1">
<div onClick={() => setSelectedTemplateId(0)}> <div onClick={() => setSelectedTemplateId(0)}>
<div <div
className={`rounded-md h-[180px] border-2 hover:border-dashed ${ className={`rounded-md h-[180px] border-2 hover:border-dashed ${

View File

@ -1,4 +1,4 @@
import { Row, Col, Button } from "@douyinfe/semi-ui"; import { Button } from "@douyinfe/semi-ui";
import { IconPlus } from "@douyinfe/semi-icons"; import { IconPlus } from "@douyinfe/semi-icons";
import Empty from "../Empty"; import Empty from "../Empty";
import { useAreas } from "../../../hooks"; import { useAreas } from "../../../hooks";
@ -12,16 +12,14 @@ export default function AreasTab() {
return ( return (
<div> <div>
<Row gutter={6}> <div className="flex gap-2">
<Col span={16}>
<SearchBar /> <SearchBar />
</Col> <div>
<Col span={8}>
<Button icon={<IconPlus />} block onClick={addArea}> <Button icon={<IconPlus />} block onClick={addArea}>
{t("add_area")} {t("add_area")}
</Button> </Button>
</Col> </div>
</Row> </div>
{areas.length <= 0 ? ( {areas.length <= 0 ? (
<Empty <Empty
title={t("no_subject_areas")} title={t("no_subject_areas")}

View File

@ -1,4 +1,4 @@
import { Row, Col, Button, Collapse } from "@douyinfe/semi-ui"; import { Button, Collapse } from "@douyinfe/semi-ui";
import { IconPlus } from "@douyinfe/semi-icons"; import { IconPlus } from "@douyinfe/semi-icons";
import { useNotes, useSelect } from "../../../hooks"; import { useNotes, useSelect } from "../../../hooks";
import Empty from "../Empty"; import Empty from "../Empty";
@ -13,8 +13,7 @@ export default function NotesTab() {
return ( return (
<> <>
<Row gutter={6}> <div className="flex gap-2">
<Col span={16}>
<SearchBar <SearchBar
setActiveKey={(activeKey) => setActiveKey={(activeKey) =>
setSelectedElement((prev) => ({ setSelectedElement((prev) => ({
@ -23,13 +22,12 @@ export default function NotesTab() {
})) }))
} }
/> />
</Col> <div>
<Col span={8}>
<Button icon={<IconPlus />} block onClick={() => addNote()}> <Button icon={<IconPlus />} block onClick={() => addNote()}>
{t("add_note")} {t("add_note")}
</Button> </Button>
</Col> </div>
</Row> </div>
{notes.length <= 0 ? ( {notes.length <= 0 ? (
<Empty title={t("no_notes")} text={t("no_notes_text")} /> <Empty title={t("no_notes")} text={t("no_notes_text")} />
) : ( ) : (

View File

@ -1,8 +1,6 @@
import { useState } from "react"; import { useState } from "react";
import { import {
Collapse, Collapse,
Row,
Col,
Input, Input,
TextArea, TextArea,
Button, Button,
@ -210,8 +208,8 @@ export default function TableInfo({ data }) {
</Collapse.Panel> </Collapse.Panel>
</Collapse> </Collapse>
</Card> </Card>
<Row gutter={6} className="mt-2"> <div className="flex justify-between items-center gap-1 mb-2">
<Col span={8}> <div>
<Popover <Popover
content={ content={
<div className="popover-theme"> <div className="popover-theme">
@ -263,12 +261,12 @@ export default function TableInfo({ data }) {
showArrow showArrow
> >
<div <div
className="h-[32px] w-[32px] rounded mb-2" className="h-[32px] w-[32px] rounded"
style={{ backgroundColor: data.color }} style={{ backgroundColor: data.color }}
/> />
</Popover> </Popover>
</Col> </div>
<Col span={7}> <div className="flex gap-1">
<Button <Button
block block
onClick={() => { onClick={() => {
@ -302,8 +300,6 @@ export default function TableInfo({ data }) {
> >
{t("add_index")} {t("add_index")}
</Button> </Button>
</Col>
<Col span={6}>
<Button <Button
onClick={() => { onClick={() => {
setUndoStack((prev) => [ setUndoStack((prev) => [
@ -342,15 +338,13 @@ export default function TableInfo({ data }) {
> >
{t("add_field")} {t("add_field")}
</Button> </Button>
</Col>
<Col span={3}>
<Button <Button
icon={<IconDeleteStroked />} icon={<IconDeleteStroked />}
type="danger" type="danger"
onClick={() => deleteTable(data.id)} onClick={() => deleteTable(data.id)}
/> />
</Col> </div>
</Row> </div>
</div> </div>
); );
} }

View File

@ -1,4 +1,4 @@
import { Collapse, Row, Col, Button } from "@douyinfe/semi-ui"; import { Collapse, Button } from "@douyinfe/semi-ui";
import { IconPlus } from "@douyinfe/semi-icons"; import { IconPlus } from "@douyinfe/semi-icons";
import { useSelect, useTables } from "../../../hooks"; import { useSelect, useTables } from "../../../hooks";
import { ObjectType } from "../../../data/constants"; import { ObjectType } from "../../../data/constants";
@ -14,16 +14,14 @@ export default function TablesTab() {
return ( return (
<> <>
<Row gutter={6}> <div className="flex gap-2">
<Col span={16}>
<SearchBar tables={tables} /> <SearchBar tables={tables} />
</Col> <div>
<Col span={8}>
<Button icon={<IconPlus />} block onClick={() => addTable()}> <Button icon={<IconPlus />} block onClick={() => addTable()}>
{t("add_table")} {t("add_table")}
</Button> </Button>
</Col> </div>
</Row> </div>
{tables.length === 0 ? ( {tables.length === 0 ? (
<Empty title={t("no_tables")} text={t("no_tables_text")} /> <Empty title={t("no_tables")} text={t("no_tables_text")} />
) : ( ) : (

View File

@ -1,4 +1,4 @@
import { Collapse, Row, Col, Button, Popover } from "@douyinfe/semi-ui"; import { Collapse, Button, Popover } from "@douyinfe/semi-ui";
import { IconPlus, IconInfoCircle } from "@douyinfe/semi-icons"; import { IconPlus, IconInfoCircle } from "@douyinfe/semi-icons";
import { useSelect, useTypes } from "../../../hooks"; import { useSelect, useTypes } from "../../../hooks";
import { ObjectType } from "../../../data/constants"; import { ObjectType } from "../../../data/constants";
@ -14,16 +14,13 @@ export default function TypesTab() {
return ( return (
<> <>
<Row gutter={6}> <div className="flex gap-2">
<Col span={13}>
<Searchbar /> <Searchbar />
</Col> <div>
<Col span={8}>
<Button icon={<IconPlus />} block onClick={() => addType()}> <Button icon={<IconPlus />} block onClick={() => addType()}>
{t("add_type")} {t("add_type")}
</Button> </Button>
</Col> </div>
<Col span={3}>
<Popover <Popover
content={ content={
<div className="w-[240px] text-sm space-y-2 popover-theme"> <div className="w-[240px] text-sm space-y-2 popover-theme">
@ -39,8 +36,7 @@ export default function TypesTab() {
> >
<Button theme="borderless" icon={<IconInfoCircle />} /> <Button theme="borderless" icon={<IconInfoCircle />} />
</Popover> </Popover>
</Col> </div>
</Row>
{types.length <= 0 ? ( {types.length <= 0 ? (
<Empty title={t("no_types")} text={t("no_types_text")} /> <Empty title={t("no_types")} text={t("no_types_text")} />
) : ( ) : (