Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

SpecialText #437

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
8f14cb4
Created 'SpecialText'; a component to replace 'HighlightedText'.
ericlin11354 Jan 22, 2022
7a443f8
Added SpecialText to index.ts
ericlin11354 Jan 22, 2022
c59b8d3
Removed onChange function
ericlin11354 Jan 22, 2022
e790175
Added JSDocs. Exposed Dropdown Props. Renamed 'options' to 'dropDownO…
ericlin11354 Jan 22, 2022
e649202
Made dropDownProps optional
ericlin11354 Jan 22, 2022
e1e3707
Renamed 'child' to dropDownItems. Removed unecessary variable 'val'. …
ericlin11354 Jan 22, 2022
00bb45c
Fixed SpecialText to be an Atom component. SpecialTextProps extends T…
ericlin11354 Jan 27, 2022
cdc4a06
added DropArea to index.ts
roggc Jan 17, 2022
18a543b
add story isDragEnter
roggc Jan 17, 2022
7b8ad26
set default padding to theme value
roggc Jan 17, 2022
5410bf2
add dropzone component
roggc Jan 17, 2022
2e69295
remove function definitions in story and add argTypes
roggc Jan 17, 2022
2996e7b
use theme colors
roggc Jan 17, 2022
492c684
set default value for padding in styled-component
roggc Jan 17, 2022
57c06ef
restrict click area to a button
roggc Jan 17, 2022
39c7bb1
add story OnClickPreventDefault
roggc Jan 17, 2022
d59349b
add icon
roggc Jan 17, 2022
943ec13
add minWidth property
roggc Jan 17, 2022
537fd31
add isDisabled property
roggc Jan 17, 2022
d536bfb
add buttonText prop
roggc Jan 17, 2022
917367c
remove isDragEnter prop
roggc Jan 17, 2022
96de21f
add css pointer-events property to restrict click to the button
roggc Jan 17, 2022
354d4e9
put style properties in styled component
roggc Jan 18, 2022
1946570
remove Input styled component
roggc Jan 18, 2022
6c470fb
change minWidth property name
roggc Jan 18, 2022
65f8e13
add lottie animation and remove pointers-events css
roggc Jan 18, 2022
52054cc
change color of the border in the animation
roggc Jan 18, 2022
f24220d
make height of the lottie equal to height of the icon
roggc Jan 18, 2022
fdfb68a
remove story and set opacity for isDisabled state
roggc Jan 18, 2022
017fec2
do it without hacky css but without prevent default
roggc Jan 18, 2022
64bca63
solve height popping effect
roggc Jan 18, 2022
1fec99e
useCallback
roggc Jan 18, 2022
f6e9ea0
putting ...props to the outer component
roggc Jan 19, 2022
9ee1625
solve the problem
roggc Jan 19, 2022
c51205b
kjsfks
roggc Jan 20, 2022
105dcdb
working...
roggc Jan 20, 2022
2994f4f
first version
roggc Jan 20, 2022
1e86268
add custom buttons
roggc Jan 21, 2022
aa38b39
remove duplicate code
roggc Jan 21, 2022
c6fb643
change variable name
roggc Jan 21, 2022
dc6355c
align icons vertically
roggc Jan 21, 2022
0bc74ec
add icon file type mapping
roggc Jan 21, 2022
efdcd8b
create panelListWrapper component
roggc Jan 22, 2022
5dcec5d
add Main to styled component
roggc Jan 22, 2022
39cc383
add sequentially panels capability
roggc Jan 22, 2022
5fd713e
a little bit of refactor
roggc Jan 22, 2022
236ea8c
extract hook into another file
roggc Jan 22, 2022
fca3f60
change name to a variable
roggc Jan 22, 2022
223bd9c
with fade in effect
roggc Jan 22, 2022
536eccb
add fadeout effect
roggc Jan 22, 2022
750c2c9
add fadeOut time property
roggc Jan 22, 2022
b20ccbb
use comparison with undefined
roggc Jan 23, 2022
bf874ba
refactor useFadeOut hook a little bit
roggc Jan 23, 2022
78ce65c
jsdoc
roggc Jan 23, 2022
a0ce00c
change name to styled component
roggc Jan 23, 2022
eecb24b
change name to a prop
roggc Jan 23, 2022
4ed46ab
Organized all the components
ralph-dev Jan 26, 2022
ea5dcc2
create the files
roggc Jan 23, 2022
f598a89
fill useGetWidth.ts
roggc Jan 23, 2022
fdec54f
fill useInformativePanels.ts
roggc Jan 23, 2022
2fdc6c0
fill worker.ts
roggc Jan 23, 2022
13fbde6
fill fileuploadv2.tsx
roggc Jan 23, 2022
2f0baec
fill fileuploadv2.stories.tsx
roggc Jan 23, 2022
d7f598d
add forwardref to dropArea component
roggc Jan 23, 2022
a6fa011
make it work
roggc Jan 24, 2022
75b5ded
little modification to the code and add some comments
roggc Jan 24, 2022
533cb84
use object destructuration
roggc Jan 25, 2022
7af98ed
more object destructuring...
roggc Jan 25, 2022
ab5c0f0
more object destructuring
roggc Jan 26, 2022
cacc103
more code quality
roggc Jan 26, 2022
06057d7
add image preview capability
roggc Jan 27, 2022
02a3969
solve problem with dropArea component
roggc Jan 27, 2022
dc840a5
Added SpecialText to index.ts
ericlin11354 Jan 22, 2022
c95ca5a
Changed SpecialText stories and change onClick type
ericlin11354 Jan 28, 2022
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
28 changes: 28 additions & 0 deletions src/Containers/SpecialText/SpecialText.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { action } from '@storybook/addon-actions';
import React from 'react';
import { Meta, Story } from '@storybook/react';
import { SpecialText, SpecialTextProps } from '../index';
import { SmallText } from 'index';
import styled from 'styled-components';

const StyledSmallText = styled(SmallText)`
&: hover {
font-weight: bold;
}
`;

export default {
title: 'Components/SpecialText',
component: SpecialText,
args: {
text: 'Special Text',
children: [
<StyledSmallText onClick={action('Index 0')} children={'pie'}/>,
<StyledSmallText onClick={action('Index 1')} children={'world'}/>
],
},
} as Meta;

export const Basic: Story<SpecialTextProps> = (args) => (
<SmallText>Here we introduce <SpecialText {...args}/></SmallText>
);
64 changes: 64 additions & 0 deletions src/Containers/SpecialText/SpecialText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Dropdown, { IDropdownProps } from '../Dropdown/Dropdown';
import DropdownItem from '../Dropdown/DropdownItem';
import React, { Children, isValidElement, useCallback, useState } from 'react';
import { SmallText } from 'index';
import styled from 'styled-components';

/**
* Properties for SpecialText
* @param {string} text - Highlighted text
* @param {React.ReactNode[]} children - List of elements in DropDown
* @param {IDropdownProps} dropDownProps
*/
export interface SpecialTextProps {
text: string;
children: React.ReactNode[];
dropDownProps?: IDropdownProps[];
}

/**
* Maps SpecialText children to DropdownItems in DropDown
* @param {React.ReactNode[0]} children - Elements in the DropDown
* @returns {React.ReactNode[]} - Array of valid DropdownItems
*/
const formatList = (children: React.ReactNode[]): React.ReactNode[] =>
ericlin11354 marked this conversation as resolved.
Show resolved Hide resolved
children.map((child): React.ReactElement | null => {
if (child && isValidElement(child)) {
const val = child.props.value;
ericlin11354 marked this conversation as resolved.
Show resolved Hide resolved
return <DropdownItem {...child.props} children={child} key={val} />;
} else return null;
});

export const SpecialText: React.FC<SpecialTextProps> = ({
text,
children,
dropDownProps,
...props
}): React.ReactElement => {
const dropDownOptions = Children.toArray(children);

return (
<StyledDiv {...props}>
<Dropdown
dropdownButton={<StyledDropDownText>{text}</StyledDropDownText>}
{...dropDownProps}
>
{formatList(dropDownOptions)}
</Dropdown>
</StyledDiv>
);
};

const StyledDiv = styled.div``;

const StyledDropDownText = styled(SmallText)`
&:hover {
font-weight: bold;
}

${({ theme }): string => `
color: ${theme.colors.statusColors.orange};
`}
`;

export default SpecialText;
1 change: 1 addition & 0 deletions src/Containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ export * from './InfoHeader/InfoHeader';
export * from './StoreSelector/StoreSelector';
export * from './ScreenFlashEffect/ScreenFlashEffect';
export * from './PanelCard/PanelCard';
export * from './SpecialText/SpecialText';