mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-06 15:16:07 -06:00
refactor: introduce EmDash component and improve table semantics
Created a reusable EmDash component to standardize placeholder rendering across tables. Updated DynamicDate to use semantic <time> element instead of Button wrapper. Improved table alignment with proper left/center/right positioning in LinksSection and NameserversSection. Enhanced typography in RemarksSection with medium font weight for headings.
This commit is contained in:
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
||||
import { format } from "date-fns";
|
||||
import { formatInTimeZone } from "date-fns-tz";
|
||||
import TimeAgo from "react-timeago";
|
||||
import { Box, Button, Tooltip, Text, Flex } from "@radix-ui/themes";
|
||||
import { Box, Tooltip, Text, Flex } from "@radix-ui/themes";
|
||||
import { useDateFormat } from "@/contexts/DateFormatContext";
|
||||
|
||||
type DynamicDateProps = {
|
||||
@@ -65,9 +65,17 @@ const DynamicDate: FunctionComponent<DynamicDateProps> = ({
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<Button variant="ghost" size="1" onClick={toggleFormat} style={{ cursor: "pointer" }}>
|
||||
<Text size="2">{displayValue}</Text>
|
||||
</Button>
|
||||
<time
|
||||
dateTime={isoString}
|
||||
onClick={toggleFormat}
|
||||
style={{
|
||||
cursor: "pointer",
|
||||
textDecoration: "none",
|
||||
fontSize: "var(--font-size-2)",
|
||||
}}
|
||||
>
|
||||
{displayValue}
|
||||
</time>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
21
src/components/EmDash.tsx
Normal file
21
src/components/EmDash.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { FunctionComponent } from "react";
|
||||
import { Text } from "@radix-ui/themes";
|
||||
|
||||
/**
|
||||
* A reusable em dash component for displaying placeholder text in tables.
|
||||
*/
|
||||
const EmDash: FunctionComponent = () => {
|
||||
return (
|
||||
<Text
|
||||
size="2"
|
||||
style={{
|
||||
color: "var(--gray-a8)",
|
||||
userSelect: "none",
|
||||
}}
|
||||
>
|
||||
—
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
export default EmDash;
|
||||
Reference in New Issue
Block a user