This repository was archived by the owner on Feb 23, 2022. It is now read-only.
-
Couldn't load subscription status.
- Fork 14
SpecialText #437
Open
ericlin11354
wants to merge
74
commits into
master
Choose a base branch
from
SpecialText
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
SpecialText #437
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 7a443f8
Added SpecialText to index.ts
ericlin11354 c59b8d3
Removed onChange function
ericlin11354 e790175
Added JSDocs. Exposed Dropdown Props. Renamed 'options' to 'dropDownO…
ericlin11354 e649202
Made dropDownProps optional
ericlin11354 e1e3707
Renamed 'child' to dropDownItems. Removed unecessary variable 'val'. …
ericlin11354 00bb45c
Fixed SpecialText to be an Atom component. SpecialTextProps extends T…
ericlin11354 cdc4a06
added DropArea to index.ts
roggc 18a543b
add story isDragEnter
roggc 7b8ad26
set default padding to theme value
roggc 5410bf2
add dropzone component
roggc 2e69295
remove function definitions in story and add argTypes
roggc 2996e7b
use theme colors
roggc 492c684
set default value for padding in styled-component
roggc 57c06ef
restrict click area to a button
roggc 39c7bb1
add story OnClickPreventDefault
roggc d59349b
add icon
roggc 943ec13
add minWidth property
roggc 537fd31
add isDisabled property
roggc d536bfb
add buttonText prop
roggc 917367c
remove isDragEnter prop
roggc 96de21f
add css pointer-events property to restrict click to the button
roggc 354d4e9
put style properties in styled component
roggc 1946570
remove Input styled component
roggc 6c470fb
change minWidth property name
roggc 65f8e13
add lottie animation and remove pointers-events css
roggc 52054cc
change color of the border in the animation
roggc f24220d
make height of the lottie equal to height of the icon
roggc fdfb68a
remove story and set opacity for isDisabled state
roggc 017fec2
do it without hacky css but without prevent default
roggc 64bca63
solve height popping effect
roggc 1fec99e
useCallback
roggc f6e9ea0
putting ...props to the outer component
roggc 9ee1625
solve the problem
roggc c51205b
kjsfks
roggc 105dcdb
working...
roggc 2994f4f
first version
roggc 1e86268
add custom buttons
roggc aa38b39
remove duplicate code
roggc c6fb643
change variable name
roggc dc6355c
align icons vertically
roggc 0bc74ec
add icon file type mapping
roggc efdcd8b
create panelListWrapper component
roggc 5dcec5d
add Main to styled component
roggc 39cc383
add sequentially panels capability
roggc 5fd713e
a little bit of refactor
roggc 236ea8c
extract hook into another file
roggc fca3f60
change name to a variable
roggc 223bd9c
with fade in effect
roggc 536eccb
add fadeout effect
roggc 750c2c9
add fadeOut time property
roggc b20ccbb
use comparison with undefined
roggc bf874ba
refactor useFadeOut hook a little bit
roggc 78ce65c
jsdoc
roggc a0ce00c
change name to styled component
roggc eecb24b
change name to a prop
roggc 4ed46ab
Organized all the components
ralph-dev ea5dcc2
create the files
roggc f598a89
fill useGetWidth.ts
roggc fdec54f
fill useInformativePanels.ts
roggc 2fdc6c0
fill worker.ts
roggc 13fbde6
fill fileuploadv2.tsx
roggc 2f0baec
fill fileuploadv2.stories.tsx
roggc d7f598d
add forwardref to dropArea component
roggc a6fa011
make it work
roggc 75b5ded
little modification to the code and add some comments
roggc 533cb84
use object destructuration
roggc 7af98ed
more object destructuring...
roggc ab5c0f0
more object destructuring
roggc cacc103
more code quality
roggc 06057d7
add image preview capability
roggc 02a3969
solve problem with dropArea component
roggc dc840a5
Added SpecialText to index.ts
ericlin11354 c95ca5a
Changed SpecialText stories and change onClick type
ericlin11354 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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> | ||
| ); |
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
| 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[] => | ||
| children.map((child): React.ReactElement | null => { | ||
| if (child && isValidElement(child)) { | ||
| const val = child.props.value; | ||
ericlin11354 marked this conversation as resolved.
Outdated
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; | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.