Skip to content

Instantly share code, notes, and snippets.

View hesan-aminiloo's full-sized avatar
🎯
Focusing

Hesan Aminiloo hesan-aminiloo

🎯
Focusing
  • Fidibo
  • Tehran - Iran
View GitHub Profile
import { Colors } from "./colors";
import styles from "./JSExports.module.scss";
export const JSExports = () => {
return (
<div>
<p>
Used scss and css and JS to access these colors, kinda complicated but
useful AF
import variables from "./JSExports.module.scss";
export const Colors = variables;
@import './variables';
$primary-color: var(--primary-color);
$secondary-color: var(--secondary-color);
.boxes {
display: flex;
justify-content: space-around;
&__box {
$primary-color: #3498db;
$secondary-color: #e74c3c;
:export {
primaryColor: $primary-color;
secondaryColor: $secondary-color;
}
@import '../../styles/helpers';
.long-list {
overflow: auto;
display: flex;
@include no-scrollbar();
&__item {
min-width: 150px;
$colors: (
primary: #4038FF,
secondary: #6C7689,
success: #0AAF60,
warning: #FFBE21,
error: #EA5B5B,
);
@mixin badge-color($bg-color) {
background-color: $bg-color;
@mixin no-scrollbar() {
-ms-overflow-style: none;
scrollbar-width: none;
box-sizing: border-box;
// Hide scrollbar for Chrome, Safari and Opera
&::-webkit-scrollbar {
display: none;
}
}
@use 'sass:color';
@function hex-to-rgba($hex, $alpha: 1) {
$red: red($hex);
$green: green($hex);
$blue: blue($hex);
@return rgba($red, $green, $blue, $alpha);
}
const heavyFn = () => {
let total = 0
for (let i = 0; i <= 10000000000; i++) {
total += i
}
return total
}
console.time('test-fn')
heavyFn()
const App = () => {
const handleRenderComponent = (id, phase, actualDuration, baseDuration, startTime, commitTime) => {
console.log(`Component ${id} took ${actualDuration} to render on ${phase}`);
}
return (
<Profiler id="heavy" onRender={handleRenderComponent}>
<SomeHeavyComponent />
</Profiler>