Skip to content

Commit 18ed8a2

Browse files
committed
chore: improve styles, mobile fixes, add new pages, update docs
1 parent 1a0e07c commit 18ed8a2

24 files changed

+1360
-584
lines changed

site/components/ApiHeading.jsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import LinkedHeading from '@components/LinkedHeading';
88
import Link from '@components/Link';
99

1010

11-
const ApiHeading = ({ as, type, text, returns, link, scope, since, deprecated }) => {
11+
const ApiHeading = ({ as, type, text, returns, link, scope, since, deprecated, sticky }) => {
1212
function getType(t) {
1313
if(t.url) {
1414
return (
@@ -71,7 +71,7 @@ const ApiHeading = ({ as, type, text, returns, link, scope, since, deprecated })
7171
));
7272
}
7373

74-
return <span className="api-heading-badges">{badges}</span>;
74+
return <span className="api-heading-badges ml-auto">{badges}</span>;
7575
}
7676

7777
function formatText(text) {
@@ -126,12 +126,16 @@ const ApiHeading = ({ as, type, text, returns, link, scope, since, deprecated })
126126
}
127127

128128
return (
129-
<LinkedHeading as={as} className={clsx('api-heading', scope, type)} id={slug(text)} title={type}>
129+
<LinkedHeading as={as} className={clsx('api-heading', sticky ? 'sticky' : null, scope, type)} id={slug(text)} title={type}>
130+
<span className={clsx('api-descriptor')} aria-hidden="true">
131+
{scope && <span className="tag tag-scope">{scope}</span>}
132+
{type && <span className="tag tag-type">{type}</span>}
133+
{getBadges()}
134+
</span>
130135
<span className="api-heading-content">
131136
{formatText(text)}
132137
{getReturns()}
133138
</span>
134-
{getBadges()}
135139
</LinkedHeading>
136140
);
137141
};
@@ -144,11 +148,13 @@ ApiHeading.propTypes = {
144148
returns: PropTypes.string,
145149
link: PropTypes.string,
146150
since: PropTypes.string,
147-
deprecated: PropTypes.string
151+
deprecated: PropTypes.string,
152+
sticky: PropTypes.bool
148153
};
149154

150155
ApiHeading.defaultProps = {
151-
as: 'h4'
156+
as: 'h4',
157+
sticky: false
152158
};
153159

154160
export default ApiHeading;

site/components/Hero.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
&:hover,
100100
&:focus,
101101
&:active {
102-
@apply bg-green-500;
102+
@apply bg-green-500 text-white;
103103
}
104104
}
105105

site/components/base/Footer.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Footer = ({ variant }) => {
2020
</div>
2121
<ul role="menu" className={styles.links}>
2222
<li role="menuitem">
23-
<Link plain href="https://github.com/KyleRoss/node-lambda-log/blob/master/LICENSE">MIT License</Link>
23+
<Link plain href="/license">MIT License</Link>
2424
</li>
2525
<li role="menuitem">
2626
<Link plain href="https://github.com/KyleRoss/node-lambda-log">Github</Link>
@@ -31,6 +31,9 @@ const Footer = ({ variant }) => {
3131
<li role="menuitem">
3232
<Link plain href="https://github.com/KyleRoss/node-lambda-log/discussions">Support</Link>
3333
</li>
34+
<li role="menuitem">
35+
<Link plain href="/contributors">Contributors</Link>
36+
</li>
3437
</ul>
3538

3639
<Link plain href="https://github.com/KyleRoss/node-lambda-log/issues/new/choose" className={styles.issue}>Report Issue</Link>

site/components/base/Footer.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868

6969
.links {
70-
@apply flex gap-4 justify-end mt-2;
70+
@apply flex flex-wrap gap-4 justify-end mt-2;
7171

7272
& li {
7373
@apply mb-0;

site/docs/v3/api.mdx

Lines changed: 242 additions & 117 deletions
Large diffs are not rendered by default.

site/docs/v3/debug-logs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ log.debug('This is a debug message');
2222
log.options.debug = true;
2323

2424
log.debug('It can take all the same options as a regular log', { suchAs: 'the metadata object' }, ['and', 'tags'])
25-
// => { "level": "debug", "msg": "It can take all the same options as a regular log", "suchAs": "the metadata object", "_tags": ["and", "tags"] }
25+
// => { "_logLevel": "debug", "msg": "It can take all the same options as a regular log", "suchAs": "the metadata object", "_tags": ["and", "tags"] }
2626

2727
// Disable debug mode
2828
log.options.debug = false;

site/docs/v3/examples.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exports.handler = async function handler(event) {
2121
});
2222

2323
log.info('Starting process'); // [tl! highlight]
24-
// => { "level": "info", "msg": "Starting process", "_tags": ["index"] } [tl! reindex(null) .select-none]
24+
// => { "_logLevel": "info", "msg": "Starting process", "_tags": ["index"] } [tl! reindex(null) .select-none]
2525

2626
// ...
2727

@@ -35,7 +35,7 @@ exports.handler = async function handler(event) {
3535
return false;
3636
} catch(error) {
3737
log.error(error).throw; // [tl! highlight]
38-
// => { "level": "error", "msg": "...", "name": "Error", "stack": "...", "_tags": ["index"] } [tl! reindex(null) .select-none]
38+
// => { "_logLevel": "error", "msg": "...", "name": "Error", "stack": "...", "_tags": ["index"] } [tl! reindex(null) .select-none]
3939
}
4040
};
4141
```
@@ -52,7 +52,7 @@ const log = new LambdaLog({
5252
module.exports = {
5353
getData: async function getData(event) {
5454
log.info('Calling API with event data', { event }); // [tl! highlight]
55-
// => { "level": "info", "msg": "Calling API with event data", "event": { ... }, "_tags": ["api"] } [tl! reindex(null) .select-none]
55+
// => { "_logLevel": "info", "msg": "Calling API with event data", "event": { ... }, "_tags": ["api"] } [tl! reindex(null) .select-none]
5656

5757
// ..get data
5858

@@ -65,7 +65,7 @@ module.exports = {
6565
}
6666

6767
log.warn(`Invalid ID provided`, { id }, ['isValidId']); // [tl! highlight]
68-
// => { "level": "warn", "msg": "Invalid ID provided", "id": "...", "_tags": ["api", "isValidId"] } [tl! reindex(null) .select-none]
68+
// => { "_logLevel": "warn", "msg": "Invalid ID provided", "id": "...", "_tags": ["api", "isValidId"] } [tl! reindex(null) .select-none]
6969
return false;
7070
}
7171
};
@@ -90,7 +90,7 @@ exports.handler = async function handler(event, context) {
9090
};
9191

9292
log.info('Starting process'); // [tl! highlight]
93-
// => { "level": "info", "msg": "Starting process", "functionName": "my-lambda-function", "requestId": "xxx", "_tags": [] } [tl! reindex(null) .select-none]
93+
// => { "_logLevel": "info", "msg": "Starting process", "functionName": "my-lambda-function", "requestId": "xxx", "_tags": [] } [tl! reindex(null) .select-none]
9494

9595
// ...
9696

@@ -113,7 +113,7 @@ exports.handler = async function handler(event, context) {
113113
});
114114

115115
log.info('Starting process'); // [tl! highlight]
116-
// => { "level": "info", "msg": "Starting process", "functionName": "my-lambda-function", "requestId": "xxx", "_tags": [] } [tl! reindex(null) .select-none]
116+
// => { "_logLevel": "info", "msg": "Starting process", "functionName": "my-lambda-function", "requestId": "xxx", "_tags": [] } [tl! reindex(null) .select-none]
117117

118118
// ...
119119

site/docs/v3/metadata.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ log.options.meta.prop4 = new Error('It even handles errors!');
3535
// Example log message:
3636
log.info('Example with global metadata');
3737
/* => {
38-
"level": "info",
38+
"_logLevel": "info",
3939
"msg": "Example with global metadata",
4040
"prop1": "test",
4141
"prop2": 123,
@@ -70,7 +70,7 @@ log.options.meta.prop5 = ['more', 'data'];
7070
// Example log message:
7171
log.info('Example with global metadata');
7272
/* => {
73-
"level": "info",
73+
"_logLevel": "info",
7474
"msg": "Example with global metadata",
7575
"prop1": "test",
7676
"prop2": 123,
@@ -98,7 +98,7 @@ log.options.meta.prop1 = 'test';
9898
// Example log message:
9999
log.info('Example with local metadata', { hello: 'world' });
100100
/* => {
101-
"level": "info",
101+
"_logLevel": "info",
102102
"msg": "Example with local metadata",
103103
"prop1": "test",
104104
"hello": "world",
@@ -108,7 +108,7 @@ log.info('Example with local metadata', { hello: 'world' });
108108
// With primitive types:
109109
log.info('Example with local metadata', 'This is a string as metadata');
110110
/* => {
111-
"level": "info",
111+
"_logLevel": "info",
112112
"msg": "Example with local metadata",
113113
"prop1": "test",
114114
"meta": "This is a string as metadata",
@@ -119,7 +119,7 @@ log.info('Example with local metadata', 'This is a string as metadata');
119119
const err = new Error('Something bad happened')
120120
log.info('Example with local metadata', err);
121121
/* => {
122-
"level": "info",
122+
"_logLevel": "info",
123123
"msg": "Example with local metadata",
124124
"prop1": "test",
125125
"meta": {
@@ -134,7 +134,7 @@ log.info('Example with local metadata', err);
134134
const err = new Error('Something bad happened')
135135
log.info('Example with local metadata', { err });
136136
/* => {
137-
"level": "info",
137+
"_logLevel": "info",
138138
"msg": "Example with local metadata",
139139
"prop1": "test",
140140
"err": {

site/docs/v3/pretty-printing.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ const log = new LambdaLog({ // [tl! focus]
3131
**With `dev` option disabled:**
3232
```js
3333
log.info('Example log without dev mode', { hello: 'world' });
34-
/* => { "level": "info", "msg": "Example log without dev mode", "hello": "world", "_tags": [] } */
34+
/* => { "_logLevel": "info", "msg": "Example log without dev mode", "hello": "world", "_tags": [] } */
3535
```
3636

3737
**With `dev` option enabled:**
3838
```js
3939
log.info('Example log with dev mode', { hello: 'world' });
4040
/* =>
4141
{
42-
"level": "info",
42+
"_logLevel": "info",
4343
"msg": "Example log with dev mode",
4444
"hello": "world",
4545
"_tags": []

site/docs/v3/tagging.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ log.options.tags.push('some-tag', 'another-tag');
3131
// Example log message:
3232
log.info('Example with global tags');
3333
/* => {
34-
"level": "info",
34+
"_logLevel": "info",
3535
"msg": "Example with global tags",
3636
"_tags": ["some-tag", "another-tag"]
3737
} */
@@ -56,7 +56,7 @@ log.options.tags.push('cool-tag');
5656
// Example log message:
5757
log.info('Example with global tags');
5858
/* => {
59-
"level": "info",
59+
"_logLevel": "info",
6060
"msg": "Example with global metadata",
6161
"_tags": ["some-tag", "another-tag", "cool-tag"]
6262
} */
@@ -75,7 +75,7 @@ log.options.tags.push('test');
7575
// Example log message:
7676
log.info('Example with local tags', null, ['example-tag', 'local-tag-example']);
7777
/* => {
78-
"level": "info",
78+
"_logLevel": "info",
7979
"msg": "Example with local tags",
8080
"_tags": ["test", "example-tag", "local-tag-example"]
8181
} */

0 commit comments

Comments
 (0)