Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Buford Eeds bufordeeds

🏠
Working from home
View GitHub Profile
View Toggle.js
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import './toggle.css';
export const Toggle = ({ darkMode, toggleDarkMode }) => {
return (
<span id='dark_mode_toggle'>
View Header.js
import React from 'react';
import { Toggle } from '../Toggle'
import './Header.css';
export const Header = ({ darkMode, toggleDarkMode }) => (
<div id="header__container" >
<span>&#9776;</span> {/*Placeholder for ACTUAL Hamburger Menu component*/}
<Toggle darkMode={darkMode} toggleDarkMode={toggleDarkMode} />
<span role="img" aria-label="magnifying glass">
&#x1f50d; {/* Placeholder for Search component */}
View App.test.js
import React from 'react';
import App from './App';
import { mount } from 'enzyme';
test('toggle should be rendered', () => {
const wrapper = mount(<App/>);
const toggle = wrapper.find('#dark_mode_toggle');
console.log(wrapper);
expect(toggle).to.have.lengthOf(1);
View App.js
import React, { useState } from 'react';
import { Routes } from './routes';
import { Header } from './components/Header';
import { MobileNav } from './components/MobileNav';
import './App.css';
import { library } from '@fortawesome/fontawesome-svg-core'
import { faSun, faMoon,faCoffee } from '@fortawesome/free-solid-svg-icons'
library.add(faSun,faMoon,faCoffee)
View findClosestValueInBST.js
/*
Write a function that takes in a Binary Search Tree (BST) and a target integer
value and returns the closest value to that target value contained in the BST.
Each BST node has an integer value , a
left child node, and a right child node. A node is
said to be a valid BST node if and only if it satisfies the BST
property: its value is strictly greater than the values of every
node to its left; its value is less than or equal to the values
of every node to its right; and its children nodes are either valid
BST nodes themselves or None/null.