MCPcopy Create free account
hub / github.com/fontsource/fontsource / SourceTable

Function SourceTable

website/app/components/tools/FileList.tsx:75–167  ·  view source on GitHub ↗
({
	sources,
	onRemove,
	disabled,
	expanded,
	onToggleExpanded,
}: SourceTableProps)

Source from the content-addressed store, hash-verified

73};
74
75const SourceTable = ({
76 sources,
77 onRemove,
78 disabled,
79 expanded,
80 onToggleExpanded,
81}: SourceTableProps) => {
82 const visibleSources = expanded
83 ? sources
84 : sources.slice(0, SOURCE_PREVIEW_LIMIT);
85 const hiddenCount = sources.length - SOURCE_PREVIEW_LIMIT;
86 const duplicateFilenameLabels = buildDuplicateFilenameLabels(sources);
87
88 return (
89 <>
90 <Table verticalSpacing="sm">
91 <Table.Thead>
92 <Table.Tr>
93 <Table.Th>Filename</Table.Th>
94 <Table.Th className={classes.secondaryColumn}>Format</Table.Th>
95 <Table.Th className={classes.secondaryColumn}>Size</Table.Th>
96 <Table.Th aria-label="Actions" />
97 </Table.Tr>
98 </Table.Thead>
99 <Table.Tbody>
100 {visibleSources.map((source) => {
101 const identity = sourceIdentity(source);
102
103 return (
104 <Table.Tr key={source.id}>
105 <Table.Td className={classes.filenameCell}>
106 <Text fw={500}>{source.file.name}</Text>
107 {identity && (
108 <Text size="xs" mt={4} className={classes.supportingText}>
109 {identity}
110 </Text>
111 )}
112 <Text
113 size="xs"
114 mt={4}
115 className={`${classes.mobileMetadata} ${classes.supportingText}`}
116 >
117 {sourceFormat(source.file.name)} ·{' '}
118 {formatFileSize(source.file.size)}
119 </Text>
120 {source.error && (
121 <Text size="xs" c="red" mt={4}>
122 {source.error}
123 </Text>
124 )}
125 {!source.inspection && !source.error && (
126 <Text size="xs" mt={4} className={classes.supportingText}>
127 Reading metadata…
128 </Text>
129 )}
130 </Table.Td>
131 <Table.Td className={classes.secondaryColumn}>
132 {sourceFormat(source.file.name)}

Callers

nothing calls this directly

Calls 5

formatFileSizeFunction · 0.90
sourceIdentityFunction · 0.85
sourceFormatFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected