From 0773402d084870144d49d7d8ab91d9e4c4b45dbf Mon Sep 17 00:00:00 2001 From: Eduardo Ciciliato Date: Fri, 14 Apr 2023 19:36:44 -0300 Subject: [PATCH 1/2] feat: allows subtitleRight to be a ReactNode fix: makes flat-list-empty-message className prop optional --- package.json | 2 +- src/flat-list-empty-message.tsx | 4 ++-- src/flat-list-item.tsx | 6 ++++-- src/object-flat-list-item.tsx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4567e0a..f2e28e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blb-ventures/react-flat-list", - "version": "0.6.2", + "version": "0.6.3", "description": "", "main": "./lib/index.js", "module": "./lib/index.mjs", diff --git a/src/flat-list-empty-message.tsx b/src/flat-list-empty-message.tsx index 37bc4fa..d3236a0 100644 --- a/src/flat-list-empty-message.tsx +++ b/src/flat-list-empty-message.tsx @@ -1,6 +1,6 @@ import { FC, ReactNode } from 'react'; -export const FlatListEmptyMessage: FC<{ children: ReactNode; className: string }> = ({ +export const FlatListEmptyMessage: FC<{ children: ReactNode; className?: string }> = ({ children, className, -}) =>
{children}
; +}) =>
{children}
; diff --git a/src/flat-list-item.tsx b/src/flat-list-item.tsx index 5644755..310207f 100644 --- a/src/flat-list-item.tsx +++ b/src/flat-list-item.tsx @@ -17,7 +17,7 @@ export interface FlatListItemProps { className?: string; contentClassName?: string; actionIcon?: ReactNode; - subtitleRight?: string; + subtitleRight?: string | ReactNode; subtitleRightClassName?: string; subtitleLeft?: string | ReactNode; subtitleCenterClassName?: string; @@ -96,8 +96,10 @@ export const FlatListItem: FC = ({ ) : ( imageRight )} - {subtitleRight != null && ( + {typeof subtitleRight === 'string' ? (
{subtitleRight}
+ ) : ( + subtitleRight )} {right} {hasActionIcon && ( diff --git a/src/object-flat-list-item.tsx b/src/object-flat-list-item.tsx index 3194ec2..0ee92bb 100644 --- a/src/object-flat-list-item.tsx +++ b/src/object-flat-list-item.tsx @@ -49,7 +49,7 @@ export const ObjectFlatListItem = >({ const value = isKeyData(data) ? extra.obj[data.key] : data.getValue(extra.obj); if (data.formatter) return data.formatter(value); return value != null ? String(value) : null; - }, [data, extra]); + }, [data, extra.obj]); const Component = extra.FlatListComponent ?? FlatListItem; return extra.obj == null ? null : ( Date: Tue, 25 Apr 2023 11:25:00 -0300 Subject: [PATCH 2/2] fix: fixes missing list-style none on the flat list error message css class fix: changes font-weight from medium to 500 --- package.json | 2 +- src/style.css | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f2e28e9..3a7e8fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blb-ventures/react-flat-list", - "version": "0.6.3", + "version": "0.6.4", "description": "", "main": "./lib/index.js", "module": "./lib/index.mjs", diff --git a/src/style.css b/src/style.css index d234eec..669de99 100644 --- a/src/style.css +++ b/src/style.css @@ -53,7 +53,7 @@ .flat-list-item-content-left-title { word-break: break-all; - font-weight: medium; + font-weight: 500; } .flat-list-item-content-left-subtitle { @@ -81,8 +81,9 @@ } .flat-list-error-message { + list-style: none; background-color: rgb(243, 244, 246); - font-weight: medium; + font-weight: 500; color: rgb(220, 38, 38); } @@ -107,5 +108,5 @@ .flat-list-subheader-title { font-size: 1.25rem/* 20px */; line-height: 1.75rem/* 28px */; - font-weight: medium; + font-weight: 500; }