Skip to content

Commit

Permalink
fix: top item no padding
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Mar 31, 2024
1 parent 5674788 commit 9c0a95d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/log/log-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ const Item = styled(Box)(({ theme: { palette, typography } }) => ({

interface Props {
value: ILogItem;
index: number;
}

const LogItem = (props: Props) => {
const theme = useTheme();
const { value } = props;
const { value, index } = props;
const [payload, setPayload] = useState(value.payload);
useEffect(() => {
formatAnsi(value.payload).then((res) => {
Expand All @@ -57,6 +58,7 @@ const LogItem = (props: Props) => {
sx={{
ml: 3.5,
mr: 3.5,
pt: index === 0 ? 8 : 0,
}}
>
<div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/rule/rule-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ const RuleItem = (props: Props) => {
sx={{
pl: 3.5,
pr: 3.5,
pt: index === 0 ? 8 : 0,
}}
>
<Typography
color="text.secondary"
variant="body2"
sx={{ lineHeight: 2, minWidth: 30, mr: 2.25, textAlign: "center" }}
>
{index}
{index + 1}
</Typography>

<Box sx={{ userSelect: "text" }}>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export default function LogPage() {
<Virtuoso
initialTopMostItemIndex={999}
data={filterLogs}
itemContent={(index, item) => <LogItem value={item} />}
itemContent={(index, item) => (
<LogItem index={index} value={item} />
)}
followOutput={"smooth"}
overscan={900}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function RulesPage() {
<Virtuoso
data={rules}
itemContent={(index, item) => (
<RuleItem index={index + 1} value={item} />
<RuleItem index={index} value={item} />
)}
followOutput={"smooth"}
overscan={900}
Expand Down

0 comments on commit 9c0a95d

Please sign in to comment.