nbroad HF staff commited on
Commit
149ddb7
β€’
1 Parent(s): ca87440

separate home, about, select nav item

Browse files
Files changed (4) hide show
  1. about.py +3 -22
  2. app.py +1 -1
  3. blog.py +1 -1
  4. main.py +3 -2
about.py CHANGED
@@ -3,29 +3,10 @@ from datetime import datetime
3
 
4
 
5
  def page():
6
- # me = Image('https://live.staticflickr.com/65535/53939742438_6ca1a4b3eb.jpg', alt='Nicholas Broad and his dog, Maya in Maine', caption="it'sa me", left=False, width=300)
7
- h2s = 'Hi there πŸ‘‹', 'Work Experience', "Education", "Volunteering",'Hobbies'
8
- txts = [Markdown(intro), Markdown(work), Markdown(education), Markdown(volunteering), Markdown(hobbies)]
9
  secs = Sections(h2s, txts)
10
- return BstPage(0, "", *secs)
11
-
12
- birthdate = datetime(1994, 3, 18)
13
- age_in_years = (datetime.now() - birthdate).days // 365
14
-
15
- maya_birthdate = datetime(2019, 3, 18)
16
- maya_age_in_years = (datetime.now() - maya_birthdate).days // 365
17
-
18
- intro = f"""
19
- <div class="row">
20
- <div class="col-md-7">
21
-
22
- I'm Nicholas Broad. I'm currently {age_in_years} years old, living in San Francisco, California. I'm an open-minded, curious, and self-motivated person who enjoys learning new things and working on interesting projects. I like to think of myself as friendly, humble, and a bit goofy. I live with my beautiful dog, <a href="https://www.flickr.com/photos/131470140@N06/albums/72177720295849325/">Maya</a>, who is {maya_age_in_years} years old. You can often find us at parks in SF playing fetch. Maya will almost always be wearing a bandana, as all dogs should.
23
- </div>
24
- <div class="col-md-4">
25
- <a data-flickr-embed="true" href="https://www.flickr.com/photos/131470140@N06/53939742438/in/album-72177720300307682/" title="Nico and Maya"><img src="https://live.staticflickr.com/65535/53939742438_6ca1a4b3eb.jpg" width="333" height="500" alt="Nico and Maya" class="img-fluid rounded"/></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
26
- </div>
27
- </div>
28
- """
29
 
30
  hf_start_date = datetime(2021, 12, 6)
31
  time_at_hf = (datetime.now() - hf_start_date)
 
3
 
4
 
5
  def page():
6
+ h2s = 'Work Experience', "Education", "Volunteering",'Hobbies'
7
+ txts = [Markdown(work), Markdown(education), Markdown(volunteering), Markdown(hobbies)]
 
8
  secs = Sections(h2s, txts)
9
+ return BstPage(1, "", *secs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  hf_start_date = datetime(2021, 12, 6)
12
  time_at_hf = (datetime.now() - hf_start_date)
app.py CHANGED
@@ -13,7 +13,7 @@ fh_url = "https://fastht.ml/"
13
  fh_logo = 'assets/fasthtml_logo.svg'
14
 
15
  def BstPage(selidx, title, *c):
16
- navitems = [('Home', '/'), ('Blog', '/blog')]
17
 
18
  ra_items = (
19
  A(Image(src="/assets/hf-logo.svg", width=28, height=28, cls="my-0 px-0 mx-0 py-0", left=False, pad=0), cls="ms-2 my-0 px-1 btn-lg btn", role="button", href="https://hf.co/nbroad"),
 
13
  fh_logo = 'assets/fasthtml_logo.svg'
14
 
15
  def BstPage(selidx, title, *c):
16
+ navitems = [('Home', '/'), ('About', '/about'), ('Blog', '/blog')]
17
 
18
  ra_items = (
19
  A(Image(src="/assets/hf-logo.svg", width=28, height=28, cls="my-0 px-0 mx-0 py-0", left=False, pad=0), cls="ms-2 my-0 px-1 btn-lg btn", role="button", href="https://hf.co/nbroad"),
blog.py CHANGED
@@ -12,7 +12,7 @@ NUM_RECENT_BLOGS = 20
12
  def full_page():
13
 
14
  secs = Sections(["Recent Blogs"], [Div(*[blog_preview(blog_id) for blog_id in sorted_blogs[:NUM_RECENT_BLOGS]])])
15
- return BstPage(0, '', *secs)
16
 
17
 
18
  def blog_preview(blog_id):
 
12
  def full_page():
13
 
14
  secs = Sections(["Recent Blogs"], [Div(*[blog_preview(blog_id) for blog_id in sorted_blogs[:NUM_RECENT_BLOGS]])])
15
+ return BstPage(2, '', *secs)
16
 
17
 
18
  def blog_preview(blog_id):
main.py CHANGED
@@ -1,5 +1,5 @@
1
  from fh_bootstrap import *
2
- import about, blog
3
 
4
  hdrs = (
5
  Link(href='/assets/hl-styles.css', rel='stylesheet'),
@@ -10,7 +10,8 @@ hdrs = (
10
 
11
  app,rt = fast_app(pico=False, hdrs=bst_hdrs+hdrs, live=False)
12
 
13
- app.get('/')(about.page)
 
14
  app.get('/blog')(blog.full_page)
15
 
16
  @rt("/blog/{blog_id}")
 
1
  from fh_bootstrap import *
2
+ import about, blog, home
3
 
4
  hdrs = (
5
  Link(href='/assets/hl-styles.css', rel='stylesheet'),
 
10
 
11
  app,rt = fast_app(pico=False, hdrs=bst_hdrs+hdrs, live=False)
12
 
13
+ app.get('/')(home.page)
14
+ app.get('/about')(about.page)
15
  app.get('/blog')(blog.full_page)
16
 
17
  @rt("/blog/{blog_id}")