Skip to content

Commit 5915f08

Browse files
authored
Merge pull request #74 from FilecoinFoundationWeb/fix-category-images
fix: category images
2 parents 4a7a472 + 5b174dc commit 5915f08

File tree

7 files changed

+12
-2
lines changed

7 files changed

+12
-2
lines changed

packages/fe/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Open Panda Frontend
22

3+
See the main repo readme for the most up-to-date documentation on running this project as a static site.
34

45
## Storybook
56

7+
### _Note: (Storybook is deprecated)_
8+
69
To better display the components available on the site, their properties, and the states they might appear in, a Storybook app is included in this repo.
710

811
- Each component that's developed must have its own story

packages/fe/components/blocks/category-slider-block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<div class="inner-content">
4141
<div
4242
class="background-image"
43-
:style="{ 'background-image': `url('/images/categories/${slide.id}.jpg')` }">
43+
:style="{ 'background-image': `url('/images/categories/${$GetKebab(slide.name)}.jpg')` }">
4444
</div>
4545
<div class="category">
4646
<div class="text">

packages/fe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "../../node_modules/.bin/nuxt",
88
"start": "../../node_modules/.bin/nuxt start",
99
"build": "../../node_modules/.bin/nuxt build",
10-
"generate": "../../node_modules/.bin/nuxt generate",
10+
"generate": "NODE_OPTIONS=--openssl-legacy-provider ../../node_modules/.bin/nuxt generate",
1111
"serve": "../../node_modules/.bin/nuxt serve",
1212
"launch": "../../node_modules/.bin/nuxt build && pm2 restart op-fe",
1313
"launch-stable": "../../node_modules/.bin/nuxt build && pm2 restart op-ST-fe",

packages/fe/plugins/helpers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ const ConnectWebsocket = config => (instance, next) => {
397397
})
398398
}
399399

400+
// //////////////////////////////////////////////////////// getKebab
401+
// makes any string kebab-lowercase
402+
const GetKebab = (str) => {
403+
return str.toLowerCase().replace(/[.,/#!$%^&*;:{}=_`~()]/g, '').replace(/\s+/g, '-').trim()
404+
}
405+
400406
// //////////////////////////////////////////////////////// getPrettyNameFromUrl
401407
// replace '-' to ' '
402408
// remove extension
@@ -461,6 +467,7 @@ export default ({ $config, app }, inject) => {
461467
inject('connectWebsocket', ConnectWebsocket($config))
462468
inject('GetTagBasedOnUrl', GetTagBasedOnUrl)
463469
inject('GetTargetBasedOnUrl', GetTargetBasedOnUrl)
470+
inject('GetKebab', GetKebab)
464471
inject('GetPrettyNameFromUrl', GetPrettyNameFromUrl)
465472
inject('scrollToHash', (route, element) => ScrollToHash(app, route, element))
466473
}

0 commit comments

Comments
 (0)