MDK Logo

LogsCard

Card wrapper for a vertically scrolling logs feed with a sticky header.

Card wrapper for a vertically scrolling logs feed with a sticky header.

import { LogsCard } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
typeOptionalstring
labelOptionalstring
isDarkOptionalboolean
isLoadingOptionalboolean
logsDataOptionalLogData[]
emptyMessageOptionalstring
skeletonRowsOptionalnumber
paginationOptionalLogPagination
onLogClickedOptional(uuid: string) => void

Usage

A set of components for displaying paginated incident and activity log lists inside a labeled card.

Exports

NameDescription
LogsCardHigh-level card containing a list of LogRow items, skeleton loading state, empty state, and optional pagination
LogRowA single log entry row (status dot + item content)
LogItemThe content area of a log entry (title, subtitle, body, and optional navigate arrow)
LogDotStatus indicator dot rendered to the left of a LogItem — appearance varies by type

LogsCard Props

PropTypeRequiredDefaultDescription
logsDataLogData[]no[]Array of log entries to display
typestringnoLog type ('Incidents' or 'Activity'); controls the LogDot appearance
labelstringnoCard header label
isDarkbooleannofalseApplies dark card theme
isLoadingbooleannofalseShows skeleton rows while loading
skeletonRowsnumberno4Number of skeleton rows shown during loading
emptyMessagestringno'No active incidents'Message shown when logsData is empty
paginationLogPaginationnoPagination config; hides pagination when on page 1 or data is empty
onLogClicked(uuid: string) => voidnoFired with the log UUID when a row is clicked

LogData

FieldTypeDescription
uuidstringUnique identifier
titlestringPrimary text
subtitlestringSecondary text (truncated with title tooltip)
bodystringBody text; |-separated values are split into separate lines
statusstringSeverity / status string ('Critical', 'High', 'Medium', activity status, etc.)

LogPagination

FieldTypeDescription
currentnumberCurrent page number
totalnumberTotal number of items
pageSizenumberItems per page
handlePaginationChange(page: number) => voidFired when the user changes the page

LogRow Props

PropTypeRequiredDescription
logLogDatayesLog entry data
typestringyesLog type (controls dot appearance)
styleCSSPropertiesnoInline style for the row container
onLogClicked(uuid: string) => voidnoClick handler

LogDot Props

PropTypeRequiredDescription
typestringyes'Incidents' renders a colored circle; 'Activity' renders an activity icon
statusstringyesSeverity string for color mapping

Notes

  • LOG_TYPES constants ('Incidents', 'Activity') are exported from constants.tsx.
  • Severity colors map 'Critical' → red, 'High' → high-severity style, 'Medium' → medium-severity style.

Example

/** * Runnable example for LogsCard (and supporting log components). */import { useState } from 'react'import { LogsCard } from '@tetherto/mdk-react-devkit'import type { LogData } from '@tetherto/mdk-react-devkit'const INCIDENT_LOGS: LogData[] = [  {    uuid: '1',    title: 'High temperature detected',    subtitle: 'Miner S19-042 · Rack 3',    body: 'Chip temp: 98°C|Ambient: 42°C',    status: 'Critical',  },  {    uuid: '2',    title: 'Hash rate drop',    subtitle: 'Miner S19-017 · Rack 1',    body: 'Expected: 100 TH/s|Actual: 62 TH/s',    status: 'High',  },  {    uuid: '3',    title: 'Pool connection unstable',    subtitle: 'Pool Manager',    body: 'Reconnections: 4 in last 15 min',    status: 'Medium',  },]const ACTIVITY_LOGS: LogData[] = [  {    uuid: '4',    title: 'Firmware update completed',    subtitle: '12 miners · Rack 2',    body: 'Version: 2.1.4',    status: 'Success',  },  {    uuid: '5',    title: 'Miner restarted',    subtitle: 'Miner A1346-008',    body: 'Reason: Manual restart',    status: 'Info',  },]export const LogsExample = () => {  const [page, setPage] = useState(2)  return (    <div className="mdk-example-row" style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>      {/* Incidents with pagination */}      <LogsCard        label="Recent Incidents"        type="Incidents"        logsData={INCIDENT_LOGS}        pagination={{          current: page,          total: 30,          pageSize: 3,          handlePaginationChange: setPage,        }}        onLogClicked={(uuid) => console.warn('clicked', uuid)}      />      {/* Activity log */}      <LogsCard label="Activity Log" type="Activity" logsData={ACTIVITY_LOGS} />      {/* Loading state */}      <LogsCard label="Loading…" type="Incidents" isLoading skeletonRows={4} />      {/* Empty state */}      <LogsCard        label="No Incidents"        type="Incidents"        logsData={[]}        emptyMessage="All systems normal"      />    </div>  )}