Skip to content

Commit

Permalink
Merge pull request #59 from nblackburn/feature/config
Browse files Browse the repository at this point in the history
Global config
  • Loading branch information
nblackburn committed Nov 12, 2022
2 parents cbcc39b + 0b22104 commit 193bc73
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nblackburn/website",
"private": true,
"version": "1.9.1",
"version": "1.10.0",
"scripts": {
"start": "astro dev",
"build": "astro build",
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import * as styles from './footer.css';
import { version } from '@app/package.json';
import { version } from '@root/package.json';
export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
</template>

<script lang="ts">
import { nav } from '@config/nav';
import { defineComponent } from 'vue';
import * as styles from './header.css';
import Logo from '@components/logo.vue';
import Link from '@components/link.vue';
import { nav } from '@app/src/config/nav';
import Navbar from '@components/navBar.vue';
import AccentBar from '@components/accentBar.vue';
Expand Down
3 changes: 2 additions & 1 deletion src/components/link.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import config from '@app/config';
import { h, defineComponent } from 'vue';
import { isExternalLink, buildRefLink } from '@utilities/refLink';
Expand All @@ -10,7 +11,7 @@ export default defineComponent({
ref: {
type: String,
default: 'nblackburn.uk'
default: config.seo.ref
}
},
Expand Down
35 changes: 35 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defaultPalette } from '@styles/palettes.css';

type PaletteConfig = {
default: string;
};

type SEOConfig = {
ref: string;
};

type PaginationConfig = {
limit: number;
};

interface Config {
seo: SEOConfig;
palette: PaletteConfig;
pagination: PaginationConfig;
}

const config: Config = {
seo: {
ref: 'nblackburn.uk'
},

pagination: {
limit: 4
},

palette: {
default: defaultPalette
}
};

export default config;
3 changes: 2 additions & 1 deletion src/pages/projects/[...page].astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
import config from '@app/config';
import Link from '@components/link.vue';
import PageLayout from '@layouts/page.astro';
import { GetStaticPaths, Page } from 'astro';
Expand Down Expand Up @@ -37,7 +38,7 @@ export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
};
});
return paginate(mappedProjects, { pageSize: 4 });
return paginate(mappedProjects, { pageSize: config.pagination.limit });
};
const title = 'Projects';
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/paletteManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import config from '@app/config';
import { getDate, getMonth } from 'date-fns';
import {
paletteClasses,
defaultPalette,
christmasPalette,
halloweenPalette
} from '@styles/palettes.css';
Expand All @@ -19,7 +19,7 @@ export const getActivePalette = (): string => {
return christmasPalette;
}

return defaultPalette;
return config.palette.default;
};

export const getAppliedPalettes = (element: HTMLElement): string[] => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"types": ["@astrojs/image/client"],
"jsx": "preserve",
"paths": {
"@app/*": ["*"],
"@root/*": ["*"],
"@app/*": ["src/*"],
"@config/*": ["src/config/*"],
"@styles/*": ["src/styles/*"],
"@assets/*": ["src/assets/*"],
Expand Down

0 comments on commit 193bc73

Please sign in to comment.