Skip to content

Commit

Permalink
Merge branch 'hot-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
ngblaylock committed Jul 8, 2024
2 parents a1f1afb + b1b486d commit 00ef0b9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
2. `npm run dev`

## Deploy:
1. Update package.json version
2. Commit files to new branch
3. Merge in to `master` branch. This triggers a GitHub action
4. Check the actions status at https://github.com/ngblaylock/nathanblaylock.com/actions
1. Create a new branch from an issue and checkout locally
2. Test the build with `npm run build` and `npm run preview`
3. Update package.json version
4. Merge in to `master` branch. This triggers a GitHub action to deploy the site on gh-pages
5. Check the actions status at https://github.com/ngblaylock/nathanblaylock.com/actions
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nathanblaylock.com",
"version": "2.0.3",
"version": "2.0.4",
"private": true,
"scripts": {
"blunt": "node ./node_modules/@ngblaylock/blunt-images ./blunt.config.cjs",
Expand Down
55 changes: 31 additions & 24 deletions src/routes/projects/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { projects } from '$lib/projectList';
import Debug from '$components/Debug.svelte';
let currentProject = '';
onMount(() => {
// Set all external anchor links to go to a new tab. Markdown doesn't support it.
let anchors = document.querySelectorAll('.project a:not([target="_blank"])');
Expand All @@ -14,51 +14,58 @@
a.setAttribute('target', '_blank');
}
});
currentProject = $page?.route.id?.replace('/projects/', '') || '';
});
const defaultProject = {
route: '',
alt: '',
};
$: previousProject = () => {
$: currentProject = $page.route.id?.replace('/projects/', '');
$: getNextProject = () => {
if (!currentProject) {
return defaultProject;
}
const currentProjectIndex = projects.findIndex((project) => project.route === currentProject);
if (currentProjectIndex == 0) {
return projects[projects.length - 1];
if (currentProjectIndex == -1) {
return defaultProject;
}
return projects[currentProjectIndex - 1];
if (currentProjectIndex == projects.length - 1) {
return projects[0];
}
return projects[currentProjectIndex + 1];
};
$: nextProject = () => {
$: getPrevProject = () => {
if (!currentProject) {
return defaultProject;
}
const currentProjectIndex = projects.findIndex((project) => project.route === currentProject);
if (currentProjectIndex == projects.length - 1) {
return projects[0];
if (currentProjectIndex == -1) {
return defaultProject;
}
return projects[currentProjectIndex + 1];
if (currentProjectIndex == 0) {
return projects[projects.length - 1];
}
return projects[currentProjectIndex - 1];
};
const defaultProject = {
route: '',
alt: '',
};
</script>

<div class="project mb-5 pb-3">
<div class="row" data-aos="fade-up">
<div class="col-lg-10 offset-lg-1 col-xl-8 offset-xl-2">
<slot />
<div class="d-flex justify-content-between mt-5">
{#if previousProject().route}
<a href="/projects/{previousProject().route}" class="btn btn-outline-dark text-start"
>⇽ {previousProject().alt}</a
{#if getPrevProject().route && getNextProject().route}
<div class="d-flex justify-content-between mt-5">
<a href="/projects/{getPrevProject().route}" class="btn btn-outline-dark text-end"
>{getPrevProject().alt}</a
>
{/if}
{#if nextProject().route}
<a href="/projects/{nextProject().route}" class="btn btn-outline-dark text-end"
>{nextProject().alt} ⇾</a
<a href="/projects/{getNextProject().route}" class="btn btn-outline-dark text-end"
>{getNextProject().alt}</a
>
{/if}
</div>
</div>
{/if}
</div>
</div>
</div>
Expand Down

0 comments on commit 00ef0b9

Please sign in to comment.