From a2aa9902ddb3b9059562f0f936098fe7b6fd2699 Mon Sep 17 00:00:00 2001 From: JonathonRP Date: Thu, 31 Oct 2024 00:51:15 +0000 Subject: [PATCH] fix resume preview and update toggle to only css, update structure and fix unicode flashing symbol during refresh/reload --- .astro/astro/content.d.ts | 161 +++++++++++++++++++++++ postcss.config.cjs | 28 ++++ src/components/Navbar.astro | 2 +- src/components/ThemeToggle.svelte | 44 ------- src/components/resume/Timeline.astro | 1 + src/images/ResumePreview.png | Bin 429870 -> 432957 bytes src/layouts/app.astro | 1 - src/pages/resume/index.astro | 5 + src/styles/abstracts/_font-families.scss | 136 ------------------- src/styles/abstracts/_icons.scss | 160 ++++++++++++++++++++++ src/styles/abstracts/_index.scss | 3 +- src/styles/abstracts/_mixins.scss | 1 - src/styles/base/_root.scss | 24 +++- src/styles/base/_typography.scss | 49 ++++--- src/styles/composition/_index.scss | 3 +- src/website.config.ts | 2 +- 16 files changed, 405 insertions(+), 215 deletions(-) create mode 100644 src/styles/abstracts/_icons.scss diff --git a/.astro/astro/content.d.ts b/.astro/astro/content.d.ts index e69de29..5d0328f 100644 --- a/.astro/astro/content.d.ts +++ b/.astro/astro/content.d.ts @@ -0,0 +1,161 @@ +declare module 'astro:content' { + interface RenderResult { + Content: import('astro/runtime/server/index.js').AstroComponentFactory; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + } + interface Render { + '.md': Promise; + } + + export interface RenderedContent { + html: string; + metadata?: { + imagePaths: Array; + [key: string]: unknown; + }; + } +} + +declare module 'astro:content' { + type Flatten = T extends { [K: string]: infer U } ? U : never; + + export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; + + export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; + + type AllValuesOf = T extends any ? T[keyof T] : never; + type ValidContentEntrySlug = AllValuesOf< + ContentEntryMap[C] + >['slug']; + + /** @deprecated Use `getEntry` instead. */ + export function getEntryBySlug< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + // Note that this has to accept a regular string too, for SSR + entrySlug: E, + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + + /** @deprecated Use `getEntry` instead. */ + export function getDataEntryById( + collection: C, + entryId: E, + ): Promise>; + + export function getCollection>( + collection: C, + filter?: (entry: CollectionEntry) => entry is E, + ): Promise; + export function getCollection( + collection: C, + filter?: (entry: CollectionEntry) => unknown, + ): Promise[]>; + + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >(entry: { + collection: C; + slug: E; + }): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >(entry: { + collection: C; + id: E; + }): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + slug: E, + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >( + collection: C, + id: E, + ): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + + /** Resolve an array of entry references from the same collection */ + export function getEntries( + entries: { + collection: C; + slug: ValidContentEntrySlug; + }[], + ): Promise[]>; + export function getEntries( + entries: { + collection: C; + id: keyof DataEntryMap[C]; + }[], + ): Promise[]>; + + export function render( + entry: AnyEntryMap[C][string], + ): Promise; + + export function reference( + collection: C, + ): import('astro/zod').ZodEffects< + import('astro/zod').ZodString, + C extends keyof ContentEntryMap + ? { + collection: C; + slug: ValidContentEntrySlug; + } + : { + collection: C; + id: keyof DataEntryMap[C]; + } + >; + // Allow generic `string` to avoid excessive type errors in the config + // if `dev` is not running to update as you edit. + // Invalid collection names will be caught at build time. + export function reference( + collection: C, + ): import('astro/zod').ZodEffects; + + type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; + type InferEntrySchema = import('astro/zod').infer< + ReturnTypeOrOriginal['schema']> + >; + + type ContentEntryMap = { + + }; + + type DataEntryMap = { + "resume": Record; + rendered?: RenderedContent; + filePath?: string; + body?: string +}>; + + }; + + type AnyEntryMap = ContentEntryMap & DataEntryMap; + + export type ContentConfig = typeof import("../../src/content/config.js"); +} diff --git a/postcss.config.cjs b/postcss.config.cjs index 1583a73..41910e9 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -219,10 +219,38 @@ const unitProcessor = (options = {}) => { }; }; +const sassUnicodeRootCustomProperties = (opts = { }) => { + + // Work with options here + + const rootSelectorRegExp = /^:root$/i; + const customPropertyRegExp = /^--[A-z][\w-]*$/; + return (root, result) => { + + root.walkRules(function(rule) { + if (rule.type === 'rule' && rule.selector.split(',').some(item => rootSelectorRegExp.test(item)) && Object(rule.nodes).length) { + rule.walkDecls(customPropertyRegExp,function(decl) { + let input = decl.value; + + let new_value = input; + if(input.charCodeAt(1) > 255) { + new_value = "\"\\" + input.codePointAt(input.length - 2).toString(16) + "\""; + // console.log(input,input.toString(),input.charCodeAt(1),new_value); + } + + decl.value = new_value; + + }); + } + }); + + } +}; module.exports = { plugins: [ require('postcss-sass-unicode'), + sassUnicodeRootCustomProperties(), require('postcss-preset-env')({ "minimumVendorImplementations": 1, "preserve": true diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 9fb2c69..90631be 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -11,7 +11,7 @@ const { author } = siteConfig; Resume
- + - -