-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Open Pseudo-tabs for the currently opened page #12
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use flake . | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| /node_modules | ||
| /dist | ||
| .DS_Store | ||
|
|
||
| # Nix/NixOS/direnv | ||
| .direnv/ | ||
| result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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`" | ||
| ''; | ||
| }; | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import React from 'react'; | ||
|
|
||
| import pythonIcon from '../images/python.png'; | ||
|
|
||
| export const TabBar = ({ view }) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy with this implementation; thanks!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming I use HashRouter as I commented in the related issue, maybe "view" can be renamed to "filename". Then it can be up to the router to describe what is put in the TabBar. |
||
| // 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 ( | ||
| <header className="flex mb-8"> | ||
| <div className="flex fixed w-screen background-400 mb-4 lg:ml-80 lg:pt-0 pt-24"> | ||
| <h1 | ||
| className="flex items-center background-700 py-1 px-5 gap-2 text-md text-100 font-400 border-600" | ||
| style={borderStyle} | ||
| > | ||
| <img className="w-4 opacity-80 h-4" src={pythonIcon} /> | ||
| {view} | ||
| </h1> | ||
| </div> | ||
| </header> | ||
| ); | ||
| }; | ||
|
|
||
| export default TabBar; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export * from './Navbar.js'; | ||
| export * from './TabBar.js'; | ||
| export * from './ThreeLines.js'; | ||
| export * from './X.js'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update this stuff in a new PR for using the HashRouter, but thanks for looking into why it sucks 😎 |
||
| let view = 'home.py'; | ||
| if (searchParams.has('view')) { | ||
| view = `${searchParams.get('view')}.py`; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="app"> | ||
| <VSCode.Navbar /> | ||
| {/* can route using the view string with more pages */} | ||
| <VSCode.TabBar view={view} /> | ||
| <VSCodeGuide /> | ||
| </div> | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yippee the nix stuff!!