IO-2143 Add truncation for long vehicle notes.
This commit is contained in:
@@ -8,6 +8,8 @@ export default function DataLabel({
|
|||||||
vertical,
|
vertical,
|
||||||
visible = true,
|
visible = true,
|
||||||
valueStyle = {},
|
valueStyle = {},
|
||||||
|
valueClassName,
|
||||||
|
onValueClick,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
if (!visible || (hideIfNull && !!!children)) return null;
|
if (!visible || (hideIfNull && !!!children)) return null;
|
||||||
@@ -28,7 +30,10 @@ export default function DataLabel({
|
|||||||
marginLeft: ".3rem",
|
marginLeft: ".3rem",
|
||||||
fontWeight: "bolder",
|
fontWeight: "bolder",
|
||||||
wordWrap: "break-word",
|
wordWrap: "break-word",
|
||||||
|
cursor: onValueClick !== undefined ? "pointer" : "",
|
||||||
}}
|
}}
|
||||||
|
className={valueClassName}
|
||||||
|
onClick={onValueClick}
|
||||||
>
|
>
|
||||||
{typeof children === "string" ? (
|
{typeof children === "string" ? (
|
||||||
<Typography.Text style={valueStyle}>{children}</Typography.Text>
|
<Typography.Text style={valueStyle}>{children}</Typography.Text>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
BranchesOutlined,
|
BranchesOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Space, Tag, Tooltip } from "antd";
|
import { Card, Col, Row, Space, Tag, Tooltip } from "antd";
|
||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -56,7 +56,7 @@ const colSpan = {
|
|||||||
|
|
||||||
export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [notesClamped, setNotesClamped] = useState(true);
|
||||||
const vehicleTitle = `${job.v_model_yr || ""} ${job.v_color || ""}
|
const vehicleTitle = `${job.v_model_yr || ""} ${job.v_color || ""}
|
||||||
${job.v_make_desc || ""}
|
${job.v_make_desc || ""}
|
||||||
${job.v_model_desc || ""}`.trim();
|
${job.v_model_desc || ""}`.trim();
|
||||||
@@ -229,6 +229,8 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
<DataLabel
|
<DataLabel
|
||||||
label={t("vehicles.fields.notes")}
|
label={t("vehicles.fields.notes")}
|
||||||
valueStyle={{ whiteSpace: "pre-wrap" }}
|
valueStyle={{ whiteSpace: "pre-wrap" }}
|
||||||
|
valueClassName={notesClamped ? "clamp" : ""}
|
||||||
|
onValueClick={() => setNotesClamped(!notesClamped)}
|
||||||
>
|
>
|
||||||
{job.vehicle.notes}
|
{job.vehicle.notes}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
|
|||||||
@@ -6,3 +6,12 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clamp {
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user