Skip to content

Commit

Permalink
style: add separator in model selection list
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed Jun 16, 2024
1 parent c94e258 commit 2ac0357
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export function ChatActions(props: {
items={models.map((m) => ({
title: m.name,
value: m.name,
family: m.family,
}))}
onClose={() => setShowModelSelector(false)}
onSelection={(s) => {
Expand Down
4 changes: 4 additions & 0 deletions app/components/ui-lib.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
padding: 10px 20px;
animation: slide-in ease 0.6s;

&.list-item-separator {
border-bottom: var(--border-in-dark);
}

.list-header {
display: flex;
align-items: center;
Expand Down
9 changes: 8 additions & 1 deletion app/components/ui-lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ export function Selector<T>(props: {
title: string;
subTitle?: string;
value: T;
family?: string;
}>;
defaultSelectedValue?: T;
onSelection?: (selection: T[]) => void;
Expand All @@ -500,9 +501,15 @@ export function Selector<T>(props: {
<List>
{props.items.map((item, i) => {
const selected = props.defaultSelectedValue === item.value;
const lastOfFamily =
i < props.items.length - 1 &&
item.family !== props.items[i + 1].family;
return (
<ListItem
className={styles["selector-item"]}
className={
styles["selector-item"] +
(lastOfFamily ? " " + styles["list-item-separator"] : "")
}
key={i}
title={item.title}
subTitle={item.subTitle}
Expand Down
2 changes: 2 additions & 0 deletions app/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/* stroke */
--border-in-light: 1px solid rgb(222, 222, 222);
--border-in-dark: 1px solid rgb(136, 136, 136);
}

@mixin dark {
Expand All @@ -40,6 +41,7 @@
--bar-color: rgba(255, 255, 255, 0.1);

--border-in-light: 1px solid rgba(255, 255, 255, 0.192);
--border-in-dark: 1px solid rgb(255, 255, 255, 0.56);

--theme-color: var(--gray);

Expand Down

0 comments on commit 2ac0357

Please sign in to comment.