frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Poddley.com – Follow people, not podcasts

https://poddley.com/guests/ana-kasparian/episodes
1•onesandofgrain•1m ago•0 comments

Layoffs Surge 118% in January – The Highest Since 2009

https://www.cnbc.com/2026/02/05/layoff-and-hiring-announcements-hit-their-worst-january-levels-si...
2•karakoram•1m ago•0 comments

Papyrus 114: Homer's Iliad

https://p114.homemade.systems/
1•mwenge•1m ago•1 comments

DicePit – Real-time multiplayer Knucklebones in the browser

https://dicepit.pages.dev/
1•r1z4•2m ago•1 comments

Turn-Based Structural Triggers: Prompt-Free Backdoors in Multi-Turn LLMs

https://arxiv.org/abs/2601.14340
2•PaulHoule•3m ago•0 comments

Show HN: AI Agent Tool That Keeps You in the Loop

https://github.com/dshearer/misatay
2•dshearer•4m ago•0 comments

Why Every R Package Wrapping External Tools Needs a Sitrep() Function

https://drmowinckels.io/blog/2026/sitrep-functions/
1•todsacerdoti•5m ago•0 comments

Achieving Ultra-Fast AI Chat Widgets

https://www.cjroth.com/blog/2026-02-06-chat-widgets
1•thoughtfulchris•7m ago•0 comments

Show HN: Runtime Fence – Kill switch for AI agents

https://github.com/RunTimeAdmin/ai-agent-killswitch
1•ccie14019•9m ago•1 comments

Researchers surprised by the brain benefits of cannabis usage in adults over 40

https://nypost.com/2026/02/07/health/cannabis-may-benefit-aging-brains-study-finds/
1•SirLJ•11m ago•0 comments

Peter Thiel warns the Antichrist, apocalypse linked to the 'end of modernity'

https://fortune.com/2026/02/04/peter-thiel-antichrist-greta-thunberg-end-of-modernity-billionaires/
1•randycupertino•12m ago•2 comments

USS Preble Used Helios Laser to Zap Four Drones in Expanding Testing

https://www.twz.com/sea/uss-preble-used-helios-laser-to-zap-four-drones-in-expanding-testing
2•breve•17m ago•0 comments

Show HN: Animated beach scene, made with CSS

https://ahmed-machine.github.io/beach-scene/
1•ahmedoo•18m ago•0 comments

An update on unredacting select Epstein files – DBC12.pdf liberated

https://neosmart.net/blog/efta00400459-has-been-cracked-dbc12-pdf-liberated/
1•ks2048•18m ago•0 comments

Was going to share my work

1•hiddenarchitect•21m ago•0 comments

Pitchfork: A devilishly good process manager for developers

https://pitchfork.jdx.dev/
1•ahamez•21m ago•0 comments

You Are Here

https://brooker.co.za/blog/2026/02/07/you-are-here.html
3•mltvc•26m ago•1 comments

Why social apps need to become proactive, not reactive

https://www.heyflare.app/blog/from-reactive-to-proactive-how-ai-agents-will-reshape-social-apps
1•JoanMDuarte•26m ago•1 comments

How patient are AI scrapers, anyway? – Random Thoughts

https://lars.ingebrigtsen.no/2026/02/07/how-patient-are-ai-scrapers-anyway/
1•samtrack2019•27m ago•0 comments

Vouch: A contributor trust management system

https://github.com/mitchellh/vouch
2•SchwKatze•27m ago•0 comments

I built a terminal monitoring app and custom firmware for a clock with Claude

https://duggan.ie/posts/i-built-a-terminal-monitoring-app-and-custom-firmware-for-a-desktop-clock...
1•duggan•28m ago•0 comments

Tiny C Compiler

https://bellard.org/tcc/
2•guerrilla•29m ago•0 comments

Y Combinator Founder Organizes 'March for Billionaires'

https://mlq.ai/news/ai-startup-founder-organizes-march-for-billionaires-protest-against-californi...
1•hidden80•30m ago•2 comments

Ask HN: Need feedback on the idea I'm working on

1•Yogender78•30m ago•0 comments

OpenClaw Addresses Security Risks

https://thebiggish.com/news/openclaw-s-security-flaws-expose-enterprise-risk-22-of-deployments-un...
2•vedantnair•31m ago•0 comments

Apple finalizes Gemini / Siri deal

https://www.engadget.com/ai/apple-reportedly-plans-to-reveal-its-gemini-powered-siri-in-february-...
1•vedantnair•31m ago•0 comments

Italy Railways Sabotaged

https://www.bbc.co.uk/news/articles/czr4rx04xjpo
10•vedantnair•31m ago•2 comments

Emacs-tramp-RPC: high-performance TRAMP back end using MsgPack-RPC

https://github.com/ArthurHeymans/emacs-tramp-rpc
1•fanf2•33m ago•0 comments

Nintendo Wii Themed Portfolio

https://akiraux.vercel.app/
2•s4074433•37m ago•2 comments

"There must be something like the opposite of suicide "

https://post.substack.com/p/there-must-be-something-like-the
1•rbanffy•39m ago•1 comments
Open in hackernews

Developing a Simple Universal Header Navigation Bar in HarmonyOS Next

2•flfljh•7mo ago
# Developing a Simple Universal Header Navigation Bar in HarmonyOS Next

In daily page development, most pages require a header to display navigation controls and page information. Repeating this code for every page is inefficient and leads to inconsistent implementations. This guide demonstrates how to create a reusable header component.

## Step 1: Create the NavBar Component

Create a new ArkTS file with a `@Component` decorated custom component:

``` import Utils from "../../../common/utils/Utils";

@Component export struct NavBar { // Component implementation will go here } ```

## Step 2: Implement Component Properties and UI

Add properties and build the header UI:

``` import Utils from "../../../common/utils/Utils";

@Component export struct NavBar { @Prop title: string = ''; // Header title text @Prop backImg: string = ''; // Custom back button icon path @Prop bgColor: string = '#FFFFFF';// Header background color @Prop customBack?: () => void; // Custom back button handler @Prop mode: string = 'center'; // Title alignment: 'center' or 'left'

  build() {
    Row() {
      // Back button section
      Row() {
        Image(this.backImg || Utils.getImgPath('home/adult_page_back_black.png'))
          .width(Utils.getVp(48))
          .height(Utils.getVp(48))
          .objectFit(ImageFit.Cover)
      }
      .onClick(() => {
        // Use custom handler if provided, else default back navigation
        this.customBack ? this.customBack() : router.back();
      })

      // Title section
      Row() {
        Text(this.title)
          .fontColor('#191B27')
          .fontSize(Utils.getVp(33))
          .fontWeight(FontWeight.Bold)
          .textAlign(this.mode === 'center' ? TextAlign.Center : TextAlign.Start)
          .width('100%')
      }
      .margin({ left: this.mode === 'center' ? 0 : Utils.getVp(20) })
      .flexShrink(1)  // Allow shrinking to fit content
      .height('100%')
    }
    .width('100%')
    .padding({ left: Utils.getVp(32), right: Utils.getVp(32) })
    .height(Utils.getVp(88))
    .backgroundColor(this.bgColor)
  }
} ```

## Step 3: Using the Component in Parent Views

### Center-aligned Title Example:

``` import { NavBar } from './component/NavBar';

@Entry @Component struct ParentPage { build() { Column() { NavBar({ title: 'Page Title', mode: 'center' }) // Page content here } .width('100%') .height('100%') } } ```

### Left-aligned Title Example:

``` import { NavBar } from './component/NavBar';

@Entry @Component struct ParentPage { build() { Column() { NavBar({ title: 'Page Title', mode: 'left' }) // Page content here } .width('100%') .height('100%') } } ```

## Customization Options

1. *Custom Icons*: Pass `backImg` property with image path

   ```
   NavBar({ 
     title: 'Settings',
     backImg: Utils.getImgPath('icons/custom_back.png')
   })
   ```
2. *Custom Background*: Change header color

   ```
   NavBar({ 
     title: 'Profile', 
     bgColor: '#F5F5F5'
   })
   ```
3. *Custom Back Action*: Override default navigation

   ```
   NavBar({
     title: 'Checkout',
     customBack: () => { /* Custom logic */ }
   })
   ```
## Key Features

- *Responsive Design*: Adapts to different screen sizes using `Utils.getVp()` - *Flexible Layout*: Title alignment options (center/left) - *Customizable*: Supports custom icons, colors, and behaviors - *Consistent UI*: Ensures uniform header appearance across application - *Easy Integration*: Simple props-based configuration

This implementation provides a reusable, customizable header component that eliminates code duplication and ensures consistent navigation experiences throughout your HarmonyOS Next application.

Comments

mmarian•7mo ago
You shouldn't make multiple posts like this. Put them in a blog, wait for a few days between posts. Read the HN guidelines.