-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #679 from Klimatbyran/staging
Deploy to production
- Loading branch information
Showing
12 changed files
with
88 additions
and
36 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,14 +1,16 @@ | ||
import { slugifyURL } from './slugifyURL' | ||
|
||
export const normalizeString = (input: string) => input.replace('ä', 'a').replace('ö', 'o').replace('å', 'a').toLowerCase() | ||
|
||
export const toTitleCase = (str: string) => str.replace( | ||
/\w\S*/g, | ||
(txt) => txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(), | ||
) | ||
|
||
export const ONE_WEEK_MS = 60 * 60 * 24 * 7 | ||
export const ONE_WEEK_MS = 1000 * 60 * 60 * 24 * 7 | ||
|
||
const baseURL = process.env.NODE_ENV === 'development' ? 'http://localhost:4321' : 'https://beta.klimatkollen.se' | ||
|
||
export const getCompanyURL = (companyName: string, wikiId: string) => { | ||
const baseURL = process.env.NODE_ENV === 'production' ? 'https://beta.klimatkollen.se' : 'http://localhost:4321' | ||
const dashName = companyName.toLowerCase().replaceAll(' ', '-') | ||
return `${baseURL}/foretag/${dashName}-${wikiId}` | ||
} | ||
export const getCompanyURL = (companyName: string, wikiId: string) => ( | ||
`${baseURL}/foretag/${slugifyURL(companyName)}-${wikiId}` | ||
) |
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,12 @@ | ||
import slugify from 'slugify' | ||
|
||
export const slugifyURL = (url: string, locale = 'sv') => ( | ||
slugify(url, { | ||
replacement: '-', // replace spaces with replacement character | ||
remove: undefined, // remove characters that match regex | ||
lower: true, // convert to lower case | ||
strict: true, // strip special characters except replacement | ||
locale, // locale identifier used to create locale-aware slugs | ||
trim: true, // trim leading and trailing replacement chars | ||
}) | ||
) |