-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25de386
commit cd44b02
Showing
14 changed files
with
231 additions
and
0 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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,2 @@ | ||
save-exact = true | ||
package-lock = 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,23 @@ | ||
# Frontend Mentor Blog Preview Card | ||
|
||
Here is the implementation in [Bau.js](https://github.com/grucloud/bau) of the [Frontend Mentor Blog Preview Card code challenge](https://www.frontendmentor.io/challenges/blog-preview-card-ckPaj01IcS) | ||
|
||
## Workflow | ||
|
||
Install the dependencies: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
Start a development server: | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
Build a production version: | ||
|
||
```sh | ||
npm run build | ||
``` |
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,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link | ||
rel="icon" | ||
type="image/png" | ||
href="./assets/images/favicon-32x32.png" | ||
/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Blog Preview Card | FrontendMentor</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,20 @@ | ||
{ | ||
"name": "frontendmentor-blog-preview-card", | ||
"private": true, | ||
"version": "0.85.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.0.2", | ||
"vite": "^5.2.11" | ||
}, | ||
"dependencies": { | ||
"@grucloud/bau": "^0.85.0", | ||
"@grucloud/bau-css": "^0.85.0", | ||
"@grucloud/bau-ui": "^0.85.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
examples/blog-preview-card/public/assets/images/illustration-article.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,67 @@ | ||
import { type Context } from "@grucloud/bau-ui/context"; | ||
|
||
export default function (context: Context) { | ||
const { bau, css } = context; | ||
const { h1, h3, div, p, article, img, figure, figcaption, span } = bau.tags; | ||
|
||
const className = css` | ||
border: 1px solid var(--Black); | ||
max-width: 400px; | ||
margin: auto; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.6rem; | ||
border-radius: 0.6rem; | ||
background-color: var(--White); | ||
padding: 1rem; | ||
box-shadow: 10px 10px; | ||
img { | ||
border-radius: 0.6rem; | ||
} | ||
.badge { | ||
background-color: var(--Yellow); | ||
padding: 0.4rem; | ||
border-radius: 0.3rem; | ||
font-size: smaller; | ||
font-weight: bolder; | ||
} | ||
.published-time { | ||
font-size: 0.8rem; | ||
font-weight: 500; | ||
color: var(--Grey); | ||
} | ||
figure { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: 1rem; | ||
img { | ||
width: 36px; | ||
} | ||
h3 { | ||
font-size: 1rem; | ||
font-weight: bold; | ||
} | ||
} | ||
`; | ||
|
||
return function myComponent() { | ||
return article( | ||
{ class: className }, | ||
img({ src: "./assets/images/illustration-article.svg" }), | ||
div(span({ class: "badge" }, "Learning")), | ||
div({ class: "published-time" }, "Published 21 Dec 2023"), | ||
h1("HTML & CSS foundations"), | ||
p( | ||
"These languages are the backbone of every website, defining structure, content, and presentation." | ||
), | ||
figure( | ||
img({ | ||
class: "profile-picture", | ||
src: "./assets/images/image-avatar.webp", | ||
alt: "Greg Hooper", | ||
}), | ||
figcaption(h3("Greg Hooper")) | ||
) | ||
); | ||
}; | ||
} |
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,20 @@ | ||
import { createContext, type Context } from "@grucloud/bau-ui/context"; | ||
import blogPreviewCard from "./blogPreviewCard"; | ||
|
||
import "./style.css"; | ||
|
||
const context = createContext(); | ||
|
||
const app = (context: Context) => { | ||
const { bau } = context; | ||
const { main } = bau.tags; | ||
|
||
const BlogPreviewCard = blogPreviewCard(context); | ||
|
||
return function () { | ||
return main(BlogPreviewCard()); | ||
}; | ||
}; | ||
|
||
const App = app(context); | ||
document.getElementById("app")?.replaceChildren(App()); |
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,24 @@ | ||
@import url("https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"); | ||
|
||
* { | ||
margin: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
:root { | ||
--Yellow: hsl(47, 88%, 63%); | ||
--White: hsl(0, 0%, 100%); | ||
--Grey: hsl(0, 0%, 50%); | ||
--Black: hsl(0, 0%, 7%); | ||
} | ||
|
||
body { | ||
font-family: "Inter", sans-serif; | ||
min-height: 100vh; | ||
display: grid; | ||
place-items: center; | ||
background-color: var(--Yellow); | ||
|
||
@media (max-width: 600px) { | ||
} | ||
} |
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 @@ | ||
/// <reference types="vite/client" /> |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"] | ||
} |
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,9 @@ | ||
import { defineConfig } from "vite"; | ||
|
||
export default defineConfig(({ command, mode, ssrBuild }) => { | ||
return { | ||
server: { | ||
open: true, | ||
}, | ||
}; | ||
}); |