Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range slider #17

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
dist
node_modules
node_modules

# VS code local settings
/.vscode
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
9 changes: 5 additions & 4 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap"
rel="stylesheet"
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin="true"
/>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600&family=Space+Grotesk:wght@700&display=swap"
href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=Space+Grotesk:wght@400;500;700&display=swap"
rel="stylesheet"
/>

Expand Down
56,677 changes: 18,932 additions & 37,745 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-interactions": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/builder-webpack5": "^6.5.9",
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/react": "^6.5.9",
"@storybook/storybook-deployer": "^2.8.12",
"@storybook/addon-actions": "^6.5.15",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-interactions": "^6.5.15",
"@storybook/addon-links": "^6.5.15",
"@storybook/builder-webpack5": "^6.5.15",
"@storybook/manager-webpack5": "^6.5.15",
"@storybook/react": "^6.5.15",
"@storybook/storybook-deployer": "^2.8.16",
"@storybook/testing-library": "^0.0.13",
"@types/react": "^18.0.15",
"babel-loader": "^8.2.5",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Avatar/Avatar.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../styles/boilerplate.scss'as *;
@use '../../styles/core/boilerplate.scss'as *;

.avatar {
position: relative;
Expand All @@ -16,4 +16,4 @@
text-align: center;
object-fit: cover;
}
}
}
7 changes: 3 additions & 4 deletions src/components/Badge/Badge.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
@use '../../styles/boilerplate.scss'as *;
@use '../../styles/core/boilerplate.scss'as *;

.badge {

&_primary,
&_secondary {
@include primary-font(500);
@include font-size(14);
line-height: 18px;
text-transform: capitalize;
letter-spacing: .5px;
letter-spacing: 0.5px;
padding: 5px 12px;
border-radius: 56px;
height: 28px;
Expand All @@ -23,4 +22,4 @@
background-color: $color-interaction-secondary;
color: $color-text-subtle;
}
}
}
8 changes: 2 additions & 6 deletions src/components/Button/Button.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../styles/boilerplate.scss'as *;
@use '../../styles/core/boilerplate.scss'as *;

@mixin rect_button_base() {
@include primary-font(600);
Expand Down Expand Up @@ -29,7 +29,6 @@
PRIMARY BUTTONS
******************************/


/*-------------------------------
SOLID BUTTON
-------------------------------*/
Expand Down Expand Up @@ -111,8 +110,6 @@
}
}



/******************************
SECONDARY BUTTONS
******************************/
Expand Down Expand Up @@ -198,7 +195,6 @@
}
}


/*-------------------------------
SIZES
-------------------------------*/
Expand All @@ -225,4 +221,4 @@
&_round {
padding: 12px;
}
}
}
8 changes: 4 additions & 4 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const Button = ({
<Icon
name={icon}
color="currentColor"
size={24}
classProp={text ? 'margin-right-10' : ''}
size={22}
classProp={text ? 'mr-10' : ''}
/>
) : (
''
Expand All @@ -76,8 +76,8 @@ const Button = ({
<Icon
name={icon}
color="currentColor"
size={24}
classProp={text ? 'margin-left-10' : ''}
size={22}
classProp={text ? 'ml-10' : ''}
/>
) : (
''
Expand Down
10 changes: 7 additions & 3 deletions src/components/Checkbox/Checkbox.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../styles/boilerplate.scss'as *;
@use '../../styles/core/boilerplate.scss'as *;

.container {
@include prefix(user-select, none, webkit ms moz);
Expand All @@ -7,6 +7,10 @@
align-items: center;
position: relative;
cursor: pointer;
&,
& * {
box-sizing: border-box;
}

/* Hide the browser's default checkbox */
input {
Expand Down Expand Up @@ -65,8 +69,8 @@
content: '';
position: absolute;
display: none;
left: 8px;
top: 3px;
left: 6px;
top: 1px;
width: 5px;
height: 11px;
border: solid $color-text-reverse;
Expand Down
4 changes: 2 additions & 2 deletions src/components/CopyButton/CopyButton.module.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@use '../../styles/boilerplate.scss'as *;
@use '../../styles/core/boilerplate.scss'as *;

.success {
@include primary-font(500);
@include font-size(16);
line-height: 24px;
color: $color-text-subtle;
padding: 8px;
}
}
25 changes: 25 additions & 0 deletions src/components/Crumb/Crumb.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@use '../../styles/core/boilerplate.scss'as *;

.top_right {
position: fixed;
top: 5px;
right: 5px;
}

.top_left {
position: fixed;
top: 5px;
left: 5px;
}

.bottom_right {
position: fixed;
bottom: 5px;
right: 5px;
}

.bottom_left {
position: fixed;
bottom: 5px;
left: 5px;
}
174 changes: 174 additions & 0 deletions src/components/Crumb/Crumb.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
import React, { useState, forwardRef, useImperativeHandle } from 'react';
import styles from './Crumb.module.scss';
import CrumbMessage from './CrumbMessage';
import { IconT } from '../Icon';

export type CrumbPropsT = {
classProp?: string;
};

export type CrumbInterfaceT = {
dispatchCrumb: Function;
};

export enum CrumbTypesE {
NEUTRAL = 'neutral',
SUCCESS = 'success',
ERROR = 'error',
INFO = 'info',
WARNING = 'warning',
}

export enum CrumbLocationE {
TOP_RIGHT = 'top_right',
TOP_LEFT = 'top_left',
BOTTOM_RIGHT = 'bottom_right',
BOTTOM_LEFT = 'bottom_left',
}

export type NewCrumbT = {
description: string;
duration?: number;
autoClose?: boolean;
type?: CrumbTypesE;
location?: CrumbLocationE;
pauseOnHover?: boolean;
hasIcon?: boolean;
icon?: IconT;
};

export interface CrumbI extends NewCrumbT {
id: string;
}

const Crumb = forwardRef(({ classProp = '' }: CrumbPropsT, ref) => {
const [topRightCrumbs, setTopRightCrumbs] = useState<CrumbI[]>([]);
const [topLeftCrumbs, setTopLeftCrumbs] = useState<CrumbI[]>([]);
const [bottomRightCrumbs, setBottomRightCrumbs] = useState<CrumbI[]>([]);
const [bottomLeftCrumbs, setBottomLeftCrumbs] = useState<CrumbI[]>([]);
/**
* Exposed Component API
*/
useImperativeHandle(ref, (): CrumbInterfaceT => {
return {
dispatchCrumb: dispatchCrumb,
};
});

/**
* Dispatch Crumb
* @param newCrumb
*/
const dispatchCrumb = (newCrumb: NewCrumbT) => {
// Give Crumb an ID
const crumb = {
...newCrumb,
id: String(Date.now()),
};

switch (crumb.location) {
case CrumbLocationE.TOP_RIGHT:
setTopRightCrumbs((crumbs) => [crumb, ...crumbs]);
break;

case CrumbLocationE.TOP_LEFT:
setTopLeftCrumbs((crumbs) => [crumb, ...crumbs]);
break;

case CrumbLocationE.BOTTOM_RIGHT:
setBottomRightCrumbs((crumbs) => [crumb, ...crumbs]);
break;

case CrumbLocationE.BOTTOM_LEFT:
setBottomLeftCrumbs((crumbs) => [crumb, ...crumbs]);
break;

default:
setTopRightCrumbs((crumbs) => [crumb, ...crumbs]);
break;
}
};

/**
* Filter Out Crumb
* @param crumbs
* @param id
* @returns CrumbI[]
*/
const filterCrumbs = (crumbs: CrumbI[], id: string) =>
crumbs.filter((crumb) => crumb.id != id);

/**
* Remove Crumb form state
* @param id
* @param location
*/
const selfDestruct = (id: string, location: CrumbLocationE) => {
switch (location) {
case CrumbLocationE.TOP_RIGHT:
setTopRightCrumbs((state) => filterCrumbs(state, id));
break;

case CrumbLocationE.TOP_LEFT:
setTopLeftCrumbs((state) => filterCrumbs(state, id));
break;

case CrumbLocationE.BOTTOM_RIGHT:
setBottomRightCrumbs((state) => filterCrumbs(state, id));
break;

case CrumbLocationE.BOTTOM_LEFT:
setBottomLeftCrumbs((state) => filterCrumbs(state, id));
break;

// Default to Top Right
default:
setTopRightCrumbs((state) => filterCrumbs(state, id));
break;
}
};

/**
* Get Crumb JSX
* @param crumb
* @returns JSX
*/
const renderCrumb = (crumb: CrumbI) => {
return (
<CrumbMessage selfDestruct={selfDestruct} key={crumb.id} {...crumb} />
);
};

return (
<div id="lily_crumb" className={classProp}>
{/* TOP RIGHT */}
{Boolean(topRightCrumbs.length) && (
<div className={styles.top_right}>
{topRightCrumbs.map(renderCrumb)}
</div>
)}

{/* TOP LEFT */}
{Boolean(topLeftCrumbs.length) && (
<div className={styles.top_left}>{topLeftCrumbs.map(renderCrumb)}</div>
)}

{/* BOTTOM RIGHT */}
{Boolean(bottomRightCrumbs.length) && (
<div className={styles.bottom_right}>
{bottomRightCrumbs.map(renderCrumb)}
</div>
)}

{/* BOTTOM LEFT */}
{Boolean(bottomLeftCrumbs.length) && (
<div className={styles.bottom_left}>
{bottomLeftCrumbs.map(renderCrumb)}
</div>
)}
</div>
);
});

Crumb.displayName = 'Crumb';
export default Crumb;
Loading