-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added more comments and modified html and css files
- Loading branch information
Showing
15 changed files
with
300 additions
and
221 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,16 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true, | ||
"htmlWhitespaceSensitivity": "css", | ||
"insertPragma": false, | ||
"jsxBracketSameLine": false, | ||
"jsxSingleQuote": true, | ||
"printWidth": 120, | ||
"proseWrap": "always", | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"useTabs": false | ||
} |
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,16 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true, | ||
"htmlWhitespaceSensitivity": "css", | ||
"insertPragma": false, | ||
"jsxBracketSameLine": false, | ||
"jsxSingleQuote": true, | ||
"printWidth": 120, | ||
"proseWrap": "always", | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"useTabs": false | ||
} |
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
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,34 +1,42 @@ | ||
import { css } from 'hono/css'; | ||
import { FC } from 'hono/jsx'; | ||
import { Layout } from './Layout'; | ||
import { alphabet } from "@xkeshav/alphabet"; | ||
import { css } from "hono/css"; | ||
import { FC } from "hono/jsx"; | ||
|
||
import { alphabet } from '@xkeshav/alphabet'; | ||
import { Layout } from "./Layout"; | ||
|
||
const parentContainer = css` | ||
display:grid; | ||
display: grid; | ||
grid-gap: 4px; | ||
grid-template-columns: repeat(5,1fr); | ||
` | ||
grid-template-columns: repeat(5, 1fr); | ||
`; | ||
const itemClass = css` | ||
display: grid; | ||
height: 10rem; | ||
color: var(--text, white); | ||
background-color: hwb(var(--hue) 0% 0%); | ||
place-content: center; | ||
font-size: 4rem; | ||
border:2px solid grey; | ||
border: 2px solid grey; | ||
box-shadow: rgb(38, 57, 77) 0px 20px 30px -10px; | ||
} | ||
` | ||
`; | ||
|
||
const Letter:FC = ({what, idx}) => (<div class={itemClass} style={{ "--hue": idx*10 + 20, "--text": idx < 20 ? '#000': '#af0'}}>{what}</div>) | ||
const Letter: FC = ({ what, idx }) => ( | ||
<div | ||
class={itemClass} | ||
style={{ "--hue": idx * 10 + 20, "--text": idx < 20 ? "#000" : "#af0" }} | ||
> | ||
{what} | ||
</div> | ||
); | ||
|
||
// MARK: JSX Support | ||
export const Alphabet: FC = () => ( | ||
<Layout> | ||
<h1>Alphabets</h1> | ||
<div class={parentContainer}> | ||
{alphabet.map(((item,idx) => <Letter idx={idx} what={item} />))} | ||
</div> | ||
</Layout> | ||
<Layout> | ||
<h1>Alphabets</h1> | ||
<div class={parentContainer}> | ||
{alphabet.map((item, idx) => ( | ||
<Letter idx={idx} what={item} /> | ||
))} | ||
</div> | ||
</Layout> | ||
); | ||
|
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,104 @@ | ||
import { Hono } from "hono"; | ||
import { css, cx, Style } from "hono/css"; | ||
|
||
// MARK: HTML and CSS support syntax | ||
const colorRoute = new Hono(); | ||
|
||
const headerClass = css` | ||
background-color: hsl(250 100% 50%); | ||
color: white; | ||
padding: 1rem; | ||
`; | ||
|
||
|
||
const ColorHome = () => <><Style/><p class={headerClass}>type path /rainbow</p></>; | ||
|
||
colorRoute.get("/", (c) => c.html(<ColorHome/>)); | ||
|
||
colorRoute.get("/rainbow", (c) => { | ||
// css as object | ||
const listClass = css` | ||
background-color: #5d7065e0; | ||
list-style-type: none; | ||
display: grid; | ||
grid-auto-flow: row; | ||
gap: 0.5rem; | ||
padding: 0.5rem; | ||
& li { | ||
font-size: 2rem; | ||
margin: 0.5rem; | ||
border-bottom: 1px solid white; | ||
padding-inline: 0.5rem; | ||
letter-spacing: 0.25ch; | ||
} | ||
`; | ||
|
||
const borderClass = css` | ||
border: 4px solid black; | ||
border-radius: 0.5rem; | ||
`; | ||
// MARK: use of React Fragment | ||
return c.html( | ||
<html> | ||
<Style /> {/*this is must to insert*/} | ||
<div> | ||
{/* using cx to join classes */} | ||
<h1 class={cx(headerClass, borderClass)}>Rainbow Colors</h1> | ||
<ul class={listClass}> | ||
<li style={{ color: "violet" }}>Violet</li> | ||
<li style={{ color: "indigo" }}>Indigo</li> | ||
<li style={{ color: "blue" }}>Blue</li> | ||
<li style={{ color: "green" }}>Green</li> | ||
<li style={{ color: "yellow" }}>Yellow</li> | ||
<li style={{ color: "orange" }}>Orange</li> | ||
<li style={{ color: "red" }}>Red</li> | ||
</ul> | ||
</div> | ||
</html> | ||
); | ||
}); | ||
|
||
// path params read | ||
colorRoute.get("/:what", (c) => { | ||
const { what } = c.req.param(); // const what = c.req.param('what'); | ||
const { sz } = c.req.query(); | ||
// console.log({ what, sz }); | ||
// MARK: CSS within <Style> | ||
return c.html( | ||
<html> | ||
<head> | ||
<Style> | ||
{css` | ||
main { | ||
background: linear-gradient(45deg, ${what} 24%, pink 10%); | ||
color: black; | ||
text-align: center; | ||
font-size: ${sz ?? 2}rem; | ||
mix-blend-mode: difference; | ||
padding: 1rem; | ||
margin: 2rem; | ||
height: 30vh; | ||
border: 2px dashed grey; | ||
display: grid; | ||
place-content: center; | ||
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; | ||
& span { | ||
border: 2px dashed pink; | ||
padding: 0.5rem 1rem; | ||
} | ||
} | ||
`} | ||
</Style> | ||
</head> | ||
<body> | ||
<main> | ||
<p> | ||
Path param value is:<span>{what}</span> | ||
</p> | ||
</main> | ||
</body> | ||
</html> | ||
); | ||
}); | ||
|
||
export default colorRoute; |
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,32 +1,42 @@ | ||
import { css, Style } from 'hono/css'; | ||
import { FC } from 'hono/jsx'; | ||
type Item = {name: string; emoji: string; id: number;}; | ||
type ElementProps = { list : Item[]}; | ||
import { css, Style } from "hono/css"; | ||
import { FC } from "hono/jsx"; | ||
|
||
const main = css` | ||
display:grid; | ||
// MARK: Types | ||
type Item = { name: string; emoji: string; id: number }; | ||
type ElementProps = { list: Item[] }; | ||
|
||
// extend classes | ||
const common = css` | ||
color: var(--text, white); | ||
background-color: hwb(var(--hue, 40) 10% 60%); | ||
font-size: 4rem; | ||
`; | ||
const main__container = css` | ||
display: grid; | ||
grid-gap: 4px; | ||
grid-template-columns: repeat(2,1fr); | ||
` | ||
const element = css` | ||
grid-template-columns: repeat(2, 1fr); | ||
`; | ||
const element__item = css` | ||
${common} | ||
display: grid; | ||
height: 10rem; | ||
color: var(--text, white); | ||
background-color: hwb(var(--hue, 40) 10% 60%); | ||
place-content: center; | ||
font-size: 4rem; | ||
} | ||
` | ||
export const Element: FC<ElementProps> = ({list}) => { | ||
return ( | ||
<html> | ||
<body> | ||
<Style/> | ||
<h1>Element List : HTML supported</h1> | ||
<main class={main}> | ||
{list.map((item) => <div class={element}>{item.name} : {item.emoji} </div>)} | ||
</main> | ||
</body> | ||
</html> | ||
); | ||
} | ||
`; | ||
|
||
const Element: FC<ElementProps> = ({ list }) => ( | ||
<html> | ||
<body> | ||
<Style /> | ||
<h1>Five Elements</h1> | ||
<main class={main__container}> | ||
{list.map((item) => ( | ||
<div class={element__item}> | ||
{item.name} : {item.emoji}{" "} | ||
</div> | ||
))} | ||
</main> | ||
</body> | ||
</html> | ||
); | ||
|
||
export { Element, ElementProps }; |
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.