mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added placeholder author results
This commit is contained in:
parent
21b621c4fa
commit
86822e7e6d
1 changed files with 57 additions and 3 deletions
|
@ -104,6 +104,9 @@ function PostListItem({title, excerpt}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostResults({posts}) {
|
function PostResults({posts}) {
|
||||||
|
if (!posts?.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const PostItems = posts.map((d) => {
|
const PostItems = posts.map((d) => {
|
||||||
return (
|
return (
|
||||||
<PostListItem
|
<PostListItem
|
||||||
|
@ -121,6 +124,32 @@ function PostResults({posts}) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AuthorListItem({name}) {
|
||||||
|
return (
|
||||||
|
<div className="py-2 -mx-7 px-7 hover:bg-gray-100 cursor-pointer">
|
||||||
|
<div className="rounded-full bg-slate-600"></div>
|
||||||
|
<h2 className="text-[1.65rem] font-medium leading-tight text-gray-900">{name}</h2>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AuthorResults({authors}) {
|
||||||
|
const AuthorItems = authors.map((d) => {
|
||||||
|
return (
|
||||||
|
<AuthorListItem
|
||||||
|
key={d.name}
|
||||||
|
name={d.name}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<div className="border-t border-gray-200 py-6 px-7">
|
||||||
|
<h1 className="uppercase text-xs text-gray-400 font-semibold mb-2">Authors</h1>
|
||||||
|
{AuthorItems}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function SearchResultBox() {
|
function SearchResultBox() {
|
||||||
const posts = [
|
const posts = [
|
||||||
{
|
{
|
||||||
|
@ -137,12 +166,37 @@ function SearchResultBox() {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
if (posts?.length) {
|
const authors = [
|
||||||
|
{
|
||||||
|
name: 'Peter Johnson'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Robert Smith'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'David Jensen'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const hasResults = posts?.length || authors?.length;
|
||||||
|
if (hasResults) {
|
||||||
return (
|
return (
|
||||||
<PostResults posts={posts} />
|
<Results posts={posts} authors={authors} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <NoResultsBox />;
|
|
||||||
|
return (
|
||||||
|
<NoResultsBox />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Results({posts, authors}) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<AuthorResults authors={authors} />
|
||||||
|
<PostResults posts={posts} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NoResultsBox() {
|
function NoResultsBox() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue