Skip to content
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
37 changes: 37 additions & 0 deletions src/components/ExpandableDescription/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Typography } from "antd";
import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";
import "./style.css";

const { Paragraph } = Typography;

interface ExpandableTextProps {
text: string;
}

const expandSymbol = (
<span>
expand <ArrowDownOutlined />
</span>
);

const collapseSymbol = (
<span>
collapse <ArrowUpOutlined />
</span>
);

export const ExpandableText = ({ text }: ExpandableTextProps) => {
return (
<Paragraph
ellipsis={{
rows: 2,
expandable: "collapsible",
symbol: (expanded) =>
expanded ? collapseSymbol : expandSymbol,
}}
>
{text}
</Paragraph>
);
};
export default ExpandableText;
Comment on lines +36 to +37
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component is exported twice: once as a named export ExpandableText (line 23) and once as a default export (line 37). This is inconsistent and can lead to confusion. Since the component is imported as a named export in PackingInput/index.tsx, remove the default export.

Suggested change
};
export default ExpandableText;
};

Copilot uses AI. Check for mistakes.
8 changes: 8 additions & 0 deletions src/components/ExpandableDescription/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ant-typography-expand span, .ant-typography-collapse span {
font-size: 12px;
color: #2656AB;
}

.ant-typography-expand:hover, .ant-typography-collapse:hover {
text-decoration: underline;
}
22 changes: 14 additions & 8 deletions src/components/PackingInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import Dropdown from "../Dropdown";
import JSONViewer from "../JSONViewer";
import RecipeForm from "../RecipeForm";
import { ExpandableText } from "../ExpandableDescription";
import "./style.css";

interface PackingInputProps {
Expand Down Expand Up @@ -70,14 +71,19 @@ const PackingInput = (props: PackingInputProps): JSX.Element => {
{!recipeObj ? (
loadingText
) : (
<Tabs defaultActiveKey="1" className="recipe-content">
<Tabs.TabPane tab="Editable fields" key="1">
<RecipeForm onStartPacking={handleStartPacking} />
</Tabs.TabPane>
<Tabs.TabPane tab="Full Recipe" key="2">
<JSONViewer title="Recipe" content={recipeObj} />
</Tabs.TabPane>
</Tabs>
<>
{recipeObj.description && (
<ExpandableText text={recipeObj.description} />
)}
<Tabs defaultActiveKey="1" className="recipe-content">
<Tabs.TabPane tab="Editable fields" key="1">
<RecipeForm onStartPacking={handleStartPacking} />
</Tabs.TabPane>
<Tabs.TabPane tab="Full Recipe" key="2">
<JSONViewer title="Recipe" content={recipeObj} />
</Tabs.TabPane>
</Tabs>
</>
)}
</>
);
Expand Down
Loading