This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { useInterval } from "usehooks-ts" | |
export const ScrambleText = (props) => { | |
const { children, size } = props | |
if (typeof children !== "string") | |
throw new Error("Children of scramble text must be a single string") | |
const [scrambledText, setScrambledText] = React.useState( | |
scrambleText(children.slice(0, size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getTotal(Component): ComponentType { | |
return (props) => { | |
const [store, setStore] = globalStore() | |
useEffect(() => { | |
var total = 0 | |
var selectedData = [] | |
_.forEach(store.selectedProducts, (item) => { | |
var filteredArray = _.filter( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function addProducts(Component): ComponentType { | |
return (props) => { | |
const [store, setStore] = globalStore() | |
function toggleProduct(title) { | |
var products = _.cloneDeep(store.selectedProducts) | |
var index = store.selectedProducts.indexOf(title) | |
if (index != -1) { | |
products.splice(index, 1) | |
setStore({ selectedProducts: products }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { addPropertyControls, ControlType } from "framer" | |
import { useEffect, useRef, useState } from "react" | |
import { | |
Chart as ChartJS, | |
CategoryScale, | |
LinearScale, | |
PointElement, | |
LineElement, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ComponentType } from "react" | |
import { useState, useEffect } from "react" | |
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0" | |
import { randomColor } from "https://framer.com/m/framer/utils.js@^0.9.0" | |
import { globalStore, callAPI, _data, sampleDataset } from "./globals.ts" | |
import _ from "lodash" | |
import Product from "../canvasComponent/haGPm0HUZ" | |
// Learn more: https://www.framer.com/docs/guides/overrides/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react" | |
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0" | |
// This will hold our state, this is where our data will be stored | |
export const globalStore = createStore({ | |
total: 0, | |
selectedProducts: [], | |
productLabels: [], | |
chartData: { | |
labels: [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import create from "zustand" | |
import { combine, persist } from "zustand/middleware" | |
export const globalStore = create( | |
persist( | |
combine( | |
{ | |
myData: {}, | |
isLoading: false, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ThemeProvider } from "@mui/styles"; | |
import React, { PropsWithChildren, useEffect, useState } from "react"; | |
import createCache from "@emotion/cache"; | |
import { CacheProvider } from "@emotion/react"; | |
import createTheme from "@mui/material/styles/createTheme"; | |
export type Props = PropsWithChildren<{}>; | |
const WrappedComponent = (props: Props) => { | |
const container = document.getElementById("custom-root"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Welcome to Code in Framer | |
// Get Started: https://www.framer.com/docs/guides/ | |
import { forwardRef, Suspense, useEffect, useRef } from "react" | |
import { ARCanvas, DefaultXRControllers } from "@react-three/xr" | |
import { useLoader } from "@react-three/fiber" | |
import { Object3D } from "three" | |
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader" | |
import throttle from "lodash.throttle" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# An implementation of Kruskal's algorithm for generating mazes. | |
# Fairly expensive, memory-wise, as it requires memory proportional | |
# to the size of the entire maze, and it's not the fastest of the | |
# algorithms (what with all the set and edge management is has to | |
# do). Also, the mazes it generates tend to have a lot of very short | |
# dead-ends, giving the maze a kind of "spiky" look. | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal | |
# that supports ANSI escape sequences. Windows users, sorry. :( |