reverse list

This commit is contained in:
2023-03-16 23:43:49 +08:00
parent 1c8a3e1462
commit bebb447498

View File

@@ -91,20 +91,27 @@ export function App() {
NEW NEW
</button> </button>
<ul> <ul>
{allChatStore.map((cs, i) => ( {allChatStore
<li> .slice()
<button .reverse()
className={`w-full my-1 p-1 rounded hover:bg-blue-300 ${ .map((cs, _i) => {
i === selectedChatIndex ? "bg-blue-500" : "bg-blue-200" // reverse
}`} const i = allChatStore.length - _i - 1;
onClick={() => { return (
setSelectedChatIndex(i); <li>
}} <button
> className={`w-full my-1 p-1 rounded hover:bg-blue-300 ${
{i} i === selectedChatIndex ? "bg-blue-500" : "bg-blue-200"
</button> }`}
</li> onClick={() => {
))} setSelectedChatIndex(i);
}}
>
{i}
</button>
</li>
);
})}
</ul> </ul>
</div> </div>
<button <button