-
Notifications
You must be signed in to change notification settings - Fork 2
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
8f6e19d
commit a5454ca
Showing
20 changed files
with
166 additions
and
62 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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const { Page, layout, image } = require('larana-js') | ||
|
||
const { header } = require('../components') | ||
|
||
class ImagePage extends Page { | ||
title() { | ||
return 'Image example' | ||
} | ||
|
||
root({ w }) { | ||
return layout({ | ||
outlineColor: '#00f', | ||
id: 'body', | ||
style: [ | ||
'body', | ||
'column', | ||
], | ||
children: [ | ||
header({}), | ||
layout({ | ||
id: 'layout1', | ||
style: { | ||
direction: w > 1028 ? 'row' : 'column', | ||
size: 9, | ||
padding: 'var:u2', | ||
gap: 'var:u2', | ||
}, | ||
outlineColor: '#0f0', | ||
children: [ | ||
image({ | ||
src: '/static/images/larana.svg', | ||
}), | ||
], | ||
}), | ||
], | ||
}) | ||
} | ||
} | ||
|
||
module.exports = { ImagePage } |
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
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,6 +1,6 @@ | ||
# Roadmap | ||
|
||
# 0.2.3 | ||
# 0.2.4 | ||
|
||
- fix: client fonts | ||
- fix: images jittering | ||
|
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
File renamed without changes.
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,23 @@ | ||
const contentTypes = { | ||
'txt': 'text/plain', | ||
'png': 'image/png', | ||
'jpg': 'image/jpeg', | ||
'jpeg': 'image/jpeg', | ||
'webp': 'image/webp', | ||
'svg': 'image/svg+xml', | ||
'ico': 'image/x-icon', | ||
// TODO: more types | ||
} | ||
|
||
const getContentType = (path) => { | ||
const ext = path.split('.').pop() | ||
|
||
const contentType = contentTypes[ext] ?? 'text/plain' | ||
|
||
return contentType | ||
} | ||
|
||
module.exports = { | ||
contentTypes, | ||
getContentType, | ||
} |
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,14 @@ | ||
const fs = require('node:fs') | ||
const { getContentType } = require('./get-content-type.js') | ||
|
||
getContentType | ||
|
||
const getFavicon = (callback) => { | ||
const faviconPath = __dirname + '/default/favicon.ico' | ||
|
||
fs.readFile(faviconPath, (_, data) => { | ||
callback({ favicon: data, contentType: getContentType(faviconPath) }) | ||
}) | ||
} | ||
|
||
module.exports = { getFavicon } |
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,5 @@ | ||
module.exports = { | ||
...require('./get-content-type.js'), | ||
...require('./read-static-file.js'), | ||
...require('./get-favicon.js'), | ||
} |
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,15 @@ | ||
const fs = require('node:fs') | ||
|
||
const prepareStatic = (staticDir) => { | ||
return (url, callback) => { | ||
const path = staticDir + url.replace('/static', '') | ||
|
||
fs.readFile(path, (err, data) => { | ||
callback(err, data) | ||
}) | ||
} | ||
} | ||
|
||
module.exports = { | ||
prepareStatic, | ||
} |
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.