-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use lit for shared components #11
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,58 +1,65 @@ | ||||||||||||||||
// Copyright The Linux Foundation and each contributor to LFX. | ||||||||||||||||
// SPDX-License-Identifier: MIT | ||||||||||||||||
|
||||||||||||||||
export const style = ` | ||||||||||||||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap'); | ||||||||||||||||
|
||||||||||||||||
:host { | ||||||||||||||||
display: block; | ||||||||||||||||
background: var(--lfx-footer-bg, transparent); | ||||||||||||||||
padding: 3rem 2rem 0 2rem; | ||||||||||||||||
color: var(--lfx-footer-text, #5b6367); | ||||||||||||||||
font-family: 'Open Sans', sans-serif; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
:host * { | ||||||||||||||||
margin: 0; | ||||||||||||||||
padding: 0; | ||||||||||||||||
box-sizing: border-box; | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
color: #808b91; | ||||||||||||||||
text-decoration: none; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.footer-container { | ||||||||||||||||
margin: 0 auto; | ||||||||||||||||
display: flex; | ||||||||||||||||
justify-content: center; | ||||||||||||||||
align-items: center; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.footer-content { | ||||||||||||||||
text-align: center; | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
display: flex; | ||||||||||||||||
justify-content: center; | ||||||||||||||||
align-items: center; | ||||||||||||||||
flex-direction: column; | ||||||||||||||||
gap: 1rem; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright-container { | ||||||||||||||||
display: flex; | ||||||||||||||||
flex-direction: column; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright { | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright a { | ||||||||||||||||
color: #5b6367; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright a:hover { | ||||||||||||||||
text-decoration: underline; | ||||||||||||||||
color: #5b6367; | ||||||||||||||||
} | ||||||||||||||||
import { css } from 'lit'; | ||||||||||||||||
|
||||||||||||||||
export const style = css` | ||||||||||||||||
@font-face { | ||||||||||||||||
font-family: 'Open Sans', sans-serif; | ||||||||||||||||
src: url(https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap) format('truetype'); | ||||||||||||||||
font-weight: normal; | ||||||||||||||||
font-style: normal; | ||||||||||||||||
} | ||||||||||||||||
Comment on lines
+7
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix @font-face declaration for Google Fonts The current @font-face declaration won't work as intended. Google Fonts should be loaded via a link tag in the HTML or using the CSS Consider one of these approaches:
- @font-face {
- font-family: 'Open Sans', sans-serif;
- src: url(https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap) format('truetype');
- font-weight: normal;
- font-style: normal;
- }
+ @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap');
📝 Committable suggestion
Suggested change
|
||||||||||||||||
|
||||||||||||||||
:host { | ||||||||||||||||
display: block; | ||||||||||||||||
background: var(--lfx-footer-bg, transparent); | ||||||||||||||||
padding: 3rem 2rem 0 2rem; | ||||||||||||||||
color: var(--lfx-footer-text, #808b91); | ||||||||||||||||
font-family: 'Open Sans', sans-serif; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
:host * { | ||||||||||||||||
margin: 0; | ||||||||||||||||
padding: 0; | ||||||||||||||||
box-sizing: border-box; | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
color: var(--lfx-footer-text, #808b91); | ||||||||||||||||
text-decoration: none; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.footer-container { | ||||||||||||||||
margin: 0 auto; | ||||||||||||||||
display: flex; | ||||||||||||||||
justify-content: center; | ||||||||||||||||
align-items: center; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.footer-content { | ||||||||||||||||
text-align: center; | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
display: flex; | ||||||||||||||||
justify-content: center; | ||||||||||||||||
align-items: center; | ||||||||||||||||
flex-direction: column; | ||||||||||||||||
gap: 1rem; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright-container { | ||||||||||||||||
display: flex; | ||||||||||||||||
flex-direction: column; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright { | ||||||||||||||||
font-size: 0.75rem; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright a { | ||||||||||||||||
color: var(--lfx-footer-text, #5b6367); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
.copyright a:hover { | ||||||||||||||||
text-decoration: underline; | ||||||||||||||||
color: var(--lfx-footer-text, #5b6367); | ||||||||||||||||
} | ||||||||||||||||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50608,4 +50608,4 @@ | |
"Aura/Dark" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import browserify from 'browserify'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
const components = ['footer/footer.component.ts']; | ||
|
||
components.forEach((component) => { | ||
const componentName = path.basename(component, '.ts'); | ||
const bundlePath = `dist/browser/${componentName}.bundle.js`; | ||
|
||
browserify(`src/components/${component}`) | ||
.plugin('tsify') | ||
.bundle() | ||
.pipe(fs.createWriteStream(bundlePath)) | ||
.on('finish', () => { | ||
console.log(`Built ${bundlePath}`); | ||
}); | ||
}); | ||
Comment on lines
+11
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling and build optimizations. The current implementation lacks error handling and build optimizations. Consider these improvements:
Here's a suggested implementation: + // Ensure output directory exists
+ fs.mkdirSync(path.dirname(bundlePath), { recursive: true });
+
browserify(`src/components/${component}`)
.plugin('tsify')
+ .plugin('errorify') // Add error reporting
+ .transform('uglifyify', { sourceMap: true }) // Add minification
.bundle()
+ .on('error', (err) => {
+ console.error(`Error building ${componentName}:`, err);
+ process.exit(1);
+ })
.pipe(fs.createWriteStream(bundlePath))
.on('finish', () => {
console.log(`Built ${bundlePath}`);
- });
+ })
+ .on('error', (err) => {
+ console.error(`Error writing ${bundlePath}:`, err);
+ process.exit(1);
+ }); Don't forget to add these dependencies to package.json: {
"devDependencies": {
"errorify": "^1.0.0",
"uglifyify": "^5.0.2"
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
The
@types/browserify@^12.0.40
types package is added as a dev dependency, but there's no correspondingbrowserify
package in the dependencies. This could lead to runtime issues as the types may not match the actual implementation.browserify
as a direct dependency in package.json🔗 Analysis chain
Verify browserify version compatibility
The added
@types/browserify@^12.0.40
types package should be compatible with the installedbrowserify@^17.0.0
. Let's verify this compatibility.Also applies to: 31-31
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 484
Script:
Length of output: 303