-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Enable to export named component by adding component-export att…
…ribute (#163) * feat: Enable to export named component by adding component-export attribute * refactor: tweaks condition for valid component name * test: add test case for `isComponentName()` * test: update test data. * test: add test for component name transformation * refactor: remove redundant lowercase letter check * test: oops, fix test case description
- Loading branch information
Showing
9 changed files
with
228 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { PropsWithChildren } from 'hono/jsx' | ||
import { useState } from 'hono/jsx' | ||
import Badge from './Badge' | ||
|
||
export function NamedCounter({ | ||
children, | ||
initial = 0, | ||
id = '', | ||
}: PropsWithChildren<{ | ||
initial?: number | ||
id?: string | ||
}>) { | ||
const [count, setCount] = useState(initial) | ||
const increment = () => setCount(count + 1) | ||
return ( | ||
<div id={id}> | ||
<Badge name='Counter' /> | ||
<p>Count: {count}</p> | ||
<button onClick={increment}>Increment</button> | ||
{children} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const COMPONENT_NAME = 'component-name' | ||
export const COMPONENT_EXPORT = 'component-export' | ||
export const DATA_SERIALIZED_PROPS = 'data-serialized-props' | ||
export const DATA_HONO_TEMPLATE = 'data-hono-template' | ||
export const IMPORTING_ISLANDS_ID = '__importing_islands' as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.