Skip to content

fix: category images #74

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

Merged
merged 4 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/fe/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Open Panda Frontend

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

## Storybook

### _Note: (Storybook is deprecated)_

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.

- Each component that's developed must have its own story
Expand Down
2 changes: 1 addition & 1 deletion packages/fe/components/blocks/category-slider-block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="inner-content">
<div
class="background-image"
:style="{ 'background-image': `url('/images/categories/${slide.id}.jpg')` }">
:style="{ 'background-image': `url('/images/categories/${$GetKebab(slide.name)}.jpg')` }">
</div>
<div class="category">
<div class="text">
Expand Down
2 changes: 1 addition & 1 deletion packages/fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "../../node_modules/.bin/nuxt",
"start": "../../node_modules/.bin/nuxt start",
"build": "../../node_modules/.bin/nuxt build",
"generate": "../../node_modules/.bin/nuxt generate",
"generate": "NODE_OPTIONS=--openssl-legacy-provider ../../node_modules/.bin/nuxt generate",
"serve": "../../node_modules/.bin/nuxt serve",
"launch": "../../node_modules/.bin/nuxt build && pm2 restart op-fe",
"launch-stable": "../../node_modules/.bin/nuxt build && pm2 restart op-ST-fe",
Expand Down
7 changes: 7 additions & 0 deletions packages/fe/plugins/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@ const ConnectWebsocket = config => (instance, next) => {
})
}

// //////////////////////////////////////////////////////// getKebab
// makes any string kebab-lowercase
const GetKebab = (str) => {
return str.toLowerCase().replace(/[.,/#!$%^&*;:{}=_`~()]/g, '').replace(/\s+/g, '-').trim()
}

// //////////////////////////////////////////////////////// getPrettyNameFromUrl
// replace '-' to ' '
// remove extension
Expand Down Expand Up @@ -461,6 +467,7 @@ export default ({ $config, app }, inject) => {
inject('connectWebsocket', ConnectWebsocket($config))
inject('GetTagBasedOnUrl', GetTagBasedOnUrl)
inject('GetTargetBasedOnUrl', GetTargetBasedOnUrl)
inject('GetKebab', GetKebab)
inject('GetPrettyNameFromUrl', GetPrettyNameFromUrl)
inject('scrollToHash', (route, element) => ScrollToHash(app, route, element))
}