File tree 3 files changed +25
-7
lines changed 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,21 @@ type HeaderProps = {
49
49
} ;
50
50
51
51
const Header = ( { project, showSearch = true } : HeaderProps ) => {
52
+ const placeholder = project
53
+ ? `👉Search for a name in ${ project . name } 👈`
54
+ : "👉Search👈" ;
52
55
return (
53
56
< HeaderContainer >
54
57
< HeaderContent >
55
58
< HeaderItem width = { showSearch ? "60%" : "100%" } >
56
- < HeaderText > Python. Wabbajack Theatrical Fantasy </ HeaderText >
59
+ < HeaderText > py.wtf: Docs for Python projects on PyPI </ HeaderText >
57
60
</ HeaderItem >
58
61
{ showSearch && project && (
59
62
< HeaderItem width = "40%" >
60
- < Search descriptors = { generateProjectIndex ( project ) } />
63
+ < Search
64
+ descriptors = { generateProjectIndex ( project ) }
65
+ placeholder = { placeholder }
66
+ />
61
67
</ HeaderItem >
62
68
) }
63
69
</ HeaderContent >
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { Link } from "./navigation/Link";
10
10
11
11
type SearchParams = {
12
12
descriptors : Index ;
13
+ placeholder : string ;
13
14
} ;
14
15
15
16
const SearchContainer = styled . div `
@@ -49,6 +50,12 @@ const ItemLink = styled(Link)`
49
50
width: 100%;
50
51
` ;
51
52
53
+ const SearchInput = styled . input `
54
+ ::placeholder {
55
+ text-align: center;
56
+ }
57
+ ` ;
58
+
52
59
interface MatchProps {
53
60
result : Result ;
54
61
}
@@ -84,7 +91,7 @@ function Match({ result }: MatchProps): ReactElement {
84
91
) ;
85
92
}
86
93
87
- export const Search = ( { descriptors } : SearchParams ) => {
94
+ export const Search = ( { descriptors, placeholder } : SearchParams ) => {
88
95
const [ searchTerm , setSearchTerm ] = useState ( "" ) ;
89
96
const [ results , setResults ] = useState < Results | null > ( null ) ;
90
97
useHotkeys ( "/" , ( event ) => {
@@ -116,12 +123,13 @@ export const Search = ({ descriptors }: SearchParams) => {
116
123
117
124
return (
118
125
< SearchContainer >
119
- < input
126
+ < SearchInput
120
127
id = "Search_Input"
121
128
onChange = { ( event ) => {
122
129
setSearchTerm ( event . target . value ) ;
123
130
} }
124
131
value = { searchTerm }
132
+ placeholder = { `${ placeholder } (press / to focus)` }
125
133
onKeyDown = { ( event ) => keyPressHandler ( event , - 1 ) }
126
134
/>
127
135
{ searchTerm && results && (
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ function useHomeData() {
133
133
134
134
function humanizeTime ( timestamp : number ) {
135
135
const dt = new Intl . DateTimeFormat ( undefined , {
136
- timeStyle : "long " ,
136
+ timeStyle : "short " ,
137
137
dateStyle : "long" ,
138
138
} ) ;
139
139
return dt . format ( timestamp * 1000 ) ;
@@ -162,7 +162,10 @@ export default function Home({
162
162
< PageLayout title = "py.wtf" header = { < Header showSearch = { false } /> } >
163
163
< ProjectContainer >
164
164
< SearchContainer >
165
- < Search descriptors = { makeIndex ( descriptors ) } />
165
+ < Search
166
+ descriptors = { makeIndex ( descriptors ) }
167
+ placeholder = "👉Search for a Python package👈"
168
+ />
166
169
</ SearchContainer >
167
170
< ProjectTables >
168
171
< ProjectTable
@@ -177,7 +180,8 @@ export default function Home({
177
180
/>
178
181
</ ProjectTables >
179
182
< TimestampFooter >
180
- Generated on { humanizeTime ( generatedAt ) }
183
+ Generated on { humanizeTime ( generatedAt ) } for { descriptors . length } { " " }
184
+ projects
181
185
</ TimestampFooter >
182
186
</ ProjectContainer >
183
187
</ PageLayout >
You can’t perform that action at this time.
0 commit comments