From 2cf688cea430fcaec422d5d39c279f8b679ba6dc Mon Sep 17 00:00:00 2001 From: David Huu Pham Date: Fri, 10 May 2024 00:16:50 -0700 Subject: [PATCH 1/3] feat: Nix flake to add node and npm in a devShell * Incorrect version of npm though --- .envrc | 1 + .gitignore | 4 ++++ flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 ++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/.gitignore b/.gitignore index 891437f..2783a77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /node_modules /dist .DS_Store + +# Nix/NixOS/direnv +.direnv/ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f6b4c77 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1714253743, + "narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c1fd36b --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs@{ self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + nodePkgs = pkgs.nodejs_18.pkgs; + nativeBuildInputs = [ + pkgs.nodejs_18 + ]; + in { + devShells.default = pkgs.mkShell { + inherit nativeBuildInputs; + + shellHook = '' + echo "node `node --version`" + echo "npm `npm --version`" + ''; + }; + }); +} From 87e454487bbbba48f878422962fbbc90d58d4ee8 Mon Sep 17 00:00:00 2001 From: David Huu Pham Date: Fri, 10 May 2024 22:58:15 -0700 Subject: [PATCH 2/3] feat: Adds TabBar component * Had to hardcode some margin/padding values to work around Navbar --- lib/VSCode/navigation/TabBar.js | 31 +++++++++++++++++++++++++++++++ lib/VSCode/navigation/index.js | 1 + src/App.js | 15 ++++++--------- 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 lib/VSCode/navigation/TabBar.js diff --git a/lib/VSCode/navigation/TabBar.js b/lib/VSCode/navigation/TabBar.js new file mode 100644 index 0000000..b61c93c --- /dev/null +++ b/lib/VSCode/navigation/TabBar.js @@ -0,0 +1,31 @@ +import React from 'react'; + +import pythonIcon from '../images/python.png'; + +export const TabBar = ({ view }) => { + // border-b-0, border-l-0 does not work when border-600 is set + const borderStyle = { + borderBottom: 'none', + borderLeft: 'none', + borderWidth: '1px', + }; + + // TODO: Maybe adjust layout via `display`, + // currently hardcoding margin values + // use flex and change flex direction to float around the Navbar component? + return ( +
+
+

+ + {view} +

+
+
+ ); +}; + +export default TabBar; diff --git a/lib/VSCode/navigation/index.js b/lib/VSCode/navigation/index.js index 68283a7..f606f7b 100644 --- a/lib/VSCode/navigation/index.js +++ b/lib/VSCode/navigation/index.js @@ -1,3 +1,4 @@ export * from './Navbar.js'; +export * from './TabBar.js'; export * from './ThreeLines.js'; export * from './X.js'; diff --git a/src/App.js b/src/App.js index e15fb41..8464a0c 100644 --- a/src/App.js +++ b/src/App.js @@ -5,20 +5,17 @@ import './App.css'; import { VSCodeGuide } from './pages/VSCodeGuide'; function App() { - const [view, setView] = useState(''); - - useEffect(() => { - const searchParams = new URLSearchParams(window.location.search); - - if (searchParams.has('view')) { - setView(searchParams.get('view')); - } - }, []); + const searchParams = new URLSearchParams(window.location.search); + let view = 'home.py'; + if (searchParams.has('view')) { + view = `${searchParams.get('view')}.py`; + } return (
{/* can route using the view string with more pages */} +
); From 3e75cf9817a942b213046f002263d39c8481bb1d Mon Sep 17 00:00:00 2001 From: David Huu Pham Date: Sat, 11 May 2024 02:47:04 -0700 Subject: [PATCH 3/3] chore: Prettier fixed trailling comma --- lib/VSCode/navigation/TabBar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/VSCode/navigation/TabBar.js b/lib/VSCode/navigation/TabBar.js index b61c93c..c6cd0d5 100644 --- a/lib/VSCode/navigation/TabBar.js +++ b/lib/VSCode/navigation/TabBar.js @@ -7,7 +7,7 @@ export const TabBar = ({ view }) => { const borderStyle = { borderBottom: 'none', borderLeft: 'none', - borderWidth: '1px', + borderWidth: '1px' }; // TODO: Maybe adjust layout via `display`,