Giter Club home page Giter Club logo

react-components's Introduction

npm version Build Status

React Components

This repository is used to distribute reusable React components.

Installation

We use node 5.x and npm 3.x, so you may need to download a new version of node. The easiest way is to download nvm. We have a .nvmrc file in the root of the project, so you can just run nvm use to switch to the correct version of node.

Install dependencies by running the following in the root of the project:

  • npm i
  • Note: You must use npm 3. Type npm -v to ensure you have a 3.x version.

NPM Commands

  • To run locally, run npm run dev and head to localhost:8080
  • To run the test runner: npm test
  • To make sure your code passes linting: npm run lint
  • To create the build: npm run build

Contributing

Pull Requests

To contribute to the repository, please create a feature branch off of the dev branch. Once you're finished working on the feature, make a pull request to merge it into dev. Please make sure that every pull request has passed the build checks, which appear just before the "Merge pull request" button in github.

Code Style

Checkout the code and comments in /components/ExampleComponent for an example functional React component, .scss file, and tests.

React

  • Most components should be stateless and use the functional component pattern
  • If you need a stateful component, use ES6 classes
  • Always use PropTypes for all props
  • Use classnames for dynamic classes. See ExampleComponent for an example.

JavaScript

  • Make sure your variable names are easy to understand and descriptive. No acronyms, except for common ones like i or err.
  • Use lodash and functional JavaScript if it makes the code clearer.
  • Please use ES2015 syntax whenever possible
  • Specific rules are enforced via .eslintrc.json
  • Run npm run lint to check your code against the linter

SCSS Files

  • This repository uses flexbox for arranging content
  • The use of any extra CSS libraries should be discussed with the team
  • Use SCSS syntax, but do not overly nest
  • Use 2 spaces for indentation
  • Use variables, mixins, and classes as much as possible from our style guide
  • To include variables from the style guide mentioned above, place @import 'topcoder/tc-includes;' at the top of your .scss file. Locally, you can look in ./node_modules/appirio-styles/styles/topcoder/_tc-colors.scss to find many colors already defined (e.g. #A3A3AE => $accent-gray)
  • When adding media queries, nest them inside the element, rather than creating a new section
@import 'topcoder/tc-includes;'

$my-local-var: 50px;

.box {
  height: $my-local-var;
  width: 50px;
  color: $medium-gray;
  @media screen and (min-width: 768px) {
    height: 100px;
    width: 100px;
    color: $dark-gray;
  }

  .inside-box {
    font-size: 14px;
    @media screen and (min-width: 768px) {
      font-size: 18px;
    }
  }
}

Writing Tests

  • npm test will run the current tests
  • Place your test files in the same directory as the component it's testing
  • Test files should be named ComponentName.spec.js

Recommended Developer Tools

Syntax highlighting for ES6 and React JSX

  • Install babel via the package manager in Sublime Text
    • Note: Sublime Text 3 is required for this plugin
  • Set the plugin as the default syntax for a particular extension
    • Open a file with the .js extension
    • Select View from the menu
    • Then Syntax -> Open all with current extension as...
    • Then Babel -> JavaScript (Babel)
    • Repeat for any other extensions, e.g. .jsx

Recommended Theme

  • Install Oceanic Next Color Theme via the Sublime Text package manager.
  • Add the following to Sublime Text -> Preferences -> Settings-User (⌘ + , on Mac)
{
  "color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme",
  "theme": "Oceanic Next.sublime-theme"
}

Automatic JavaScript linting in Sublime Text

  • Install SublimeLinter following the instructions under "Installing via Package Control"
  • Install SublimeLinter-eslint with the package manager. The package is called SublimeLinter-contrib-eslint

Code expander

  • Examples:
    • div.cool-class becomes <div className="cool-class"></div>
    • a becomes <a href=""></a>
  • Install Emmet via Sublime Text package manager
  • Configure Emmet to work with React, e.g. classes expand to className instead of class
  • Follow the instructions under Get Emmet working
    • Note: Add the last snippet of code to reg_replace.sublime-settings by navigating to Sublime Text -> Preferences -> Package Settings -> Reg Replace -> Settings-User

Using the react-components repository in your app

Install

npm install appirio-tech-react-components

react-components's People

Contributors

amolskh avatar aselbie avatar colinh84 avatar krispenney avatar mahestro avatar nlitwin avatar samsep avatar utkarshkukreti avatar vietnogi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-components's Issues

Nav Bar || Complete Nav Bar

This component will be developed after all other components have been completed.

Component tree

  • nav-bar
    • topcoder-logo
    • search-bar
    • menu-bar
    • quick-links-dropdown-menu
    • user-dropdown-menu

Requirements:

  • Create a branch off of master and make a PR to master
  • Should be responsive as rendered in the design specks

New form component for skill suggestions

(Users can select multiple answers)
Answers:
Primary Answers: These answer options should be displayed immediately as checkboxes. It is optional for the user to complete this question.
Display this Text above the answer options: Most Commonly Requested Skills:

  • Structured Test Case Creation
  • Structured Test Case Execution
  • Unstructured Testing
  • Mobility Testing
  • Performance Testing
  • Test Automation

Secondary Answer Option:
Underneath the commonly requested skills, display a responsive field for the user to type in additional skills.

  • Behind this field, data should be fed from the api (https://api.topcoder.com/v3/tags/?domain=SKILLS&status=APPROVED) to identify a prefill skills matching what the user has begun to type and recommended word-completion should be generated (Note: no data will be returned for QA as this is not a defined challenge format today, so data is spotty)
  • If what the user types does not match member skill data being provided in the API, the user should still be able to complete typing and save their selection
  • Users should be able to type multiple skills into this field

TaggedValue and TaggedValueList React components

Requirements

  • Should be styled as shown in specks. Please see the bonus item in Prize tooltip
  • TaggedValue should ask for tag color, label of tag and corresponding value as properties
  • TaggedValue should render the number of times the tagged value is to be shown, as part of the component.
  • TaggedValueList should ask for color scheme, for now use two assorted and default. default would use two colors (mentioned in the specks), one for TaggedValue items where the count is greater than 1 and another for TaggedValue items where count is 1. assorted would use different colors from a fixed palette.
    Removed this requirement, as @amolskh implemented a better way to control the color schemes and delegated the logic for default theme to TaggedValue component.
  • TaggedValueList should support two different layouts (configurable via property). One layout would allow wrapping of items when all items takes more space than the parent container and another would use horizontal scroll.

Nav Bar || Search Suggestions Panel components

In this task, we are required to implement 4 components. Create a branch off of master and make a PR to master

Main panel

This panel contains two sub components. One for recent search suggestions and one for popular search suggestions.

Component tree

  • search-suggestion-panel
    • recent-search-suggestions
    • popular-search-suggestions

Requirements

  • Should have a configurable field to show/hide of any of the panels

Recent Search Suggestions Panel

This component reuses the panel component and transcludes the required DOM into it.

Component tree

  • recent-search-suggestions
    • panel
      • panel-header
      • label(text="Recent Search")
      • recent-search-panel-actions
        • recent-search-panel-action
          • a(text="Edit")
    • panel-body
      • search-suggestion-result-list

Requirements:

  • The functionality of the Edit button is not ironed out yet. So, it can be a dummy link for now.

Popular Search Suggestions Panel

This component reuses the panel component and transcludes the required DOM into it.

Component tree

  • popular-search-suggestions
    • panel
      • panel-header
        • label(text="Popular")
      • panel-body
        • search-suggestion-result-list

Search Suggestion Result List

This is a wrapper component for containing all suggestion items as std-list-item component.

Component tree

  • search-suggestion-result-list
    • std-list-item(.search-suggestion-result-list-item)

[$75] React Tooltip - Allow the tooltip to persist if mouse is moved out to tooltip itself

As of now, the tooltip component goes away as soon as the mouse goes out of the target element. This behaviour prevents the tooltips to be clickable because as user tries to move mouse to the tooltip, it goes away.

Scope

  • fix the behaviour such that the tooltip persists when user tries to hover over the tooltip itself.
  • add an example, in tooltip examples component, showing the the tooltip being clickable i.e. a tooltip with a hyperlink which user can click

Notes

  1. When tooltip is triggered on click event, tooltip is already persisting until next mouse click. So, this behaviour is required when tooltip is triggered on hover event.

SubtrackDetails React component

Requirements

  • Should follow the style described in specks
  • Track code (colored bars in top left of the component) - represents for which main track the tooltip applies (can be combo of all 3 i.e. develop, design, data science)
  • Tracks, subtrack name, subtrack code and subtrack description should be configurable via properties.
  • Subtrack description should be shown only if available i.e. it should not block the space when description is not provided.

TCFormFields.TextInput doesn't update default value from updated prop

This comes from the issue in connect-app appirio-tech/connect-app#2448

The situation looks like this:

  • We define the initial value of TCFormFields.TextInput by the value property with the value from the Redux store
  • After we edit TCFormFields.TextInput using keyboard
  • Update value in the Redux store on form submit
  • So the updated value comes to the TCFormFields.TextInput value property, but in some situations, it returns to the initial value which was before editing.

I cannot provide some proper steps to reproduce in isolation from connecta-app. So to reproduce it probably this issue in connect app may help appirio-tech/connect-app#2448

Warning: Unknown prop `'data-cap'` on <path> tag

There is a warning caused by https://github.com/appirio-tech/react-components/blob/feature/connectv2/components/Icons/round-e-help.svg

Warning: Unknown prop `'data-cap'` on <path> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
    in path (created by IconOutlineWorkProject)
    in g (created by IconOutlineWorkProject)
    in svg (created by IconOutlineWorkProject)
    in IconOutlineWorkProject (created by ProjectTypeIcon)
    in ProjectTypeIcon (created by ListItem)
    in div (created by ListItem)
    in a (created by Link)
    in Link (created by ListItem)
    in div (created by ListItem)
    in div (created by ListItem)
    in div (created by ListItem)
    in ListItem (created by GridView)
    in div (created by InfiniteScroll)
    in InfiniteScroll (created by GridView)
    in div (created by GridView)
    in div (created by GridView)
    in div (created by GridView)
    in div (created by GridView)
    in section (created by GridView)
    in GridView (created by ProjectsGridView)
    in div (created by ProjectsGridView)
    in ProjectsGridView (created by branch(ProjectsGridView))
    in branch(ProjectsGridView) (created by branch(branch(ProjectsGridView)))
    in branch(branch(ProjectsGridView)) (created by Projects)
    in div (created by Projects)
    in section (created by Projects)
    in div (created by Projects)
    in Projects (created by Connect(Projects))
    in Connect(Projects) (created by Route)
    in Route (created by withRouter(Connect(Projects)))
    in withRouter(Connect(Projects)) (created by AuthenticatedComponent)
    in div (created by AuthenticatedComponent)
    in AuthenticatedComponent (created by Route)
    in Route (created by withRouter(AuthenticatedComponent))
    in withRouter(AuthenticatedComponent) (created by Route)
    in div (created by Layout)
    in div (created by Layout)
    in Layout (created by Layout)
    in Layout (created by Connect(Layout))
    in Connect(Layout) (created by App)
    in App (created by Route)
    in Route (created by Route)
    in Switch (created by Route)
    in Route
    in Switch (created by Routes)
    in Routes (created by Route)
    in Route (created by withRouter(Routes))
    in withRouter(Routes) (created by App)
    in Router (created by BrowserRouter)
    in BrowserRouter (created by App)
    in GatewayProvider (created by App)
    in Provider (created by App)
    in App (created by HotExportedApp)
    in AppContainer (created by HotExportedApp)
    in HotExportedApp

Validation error for custom validation is not working

Custom validation message is not being rendered if we apply multiple validations to the same field and specify error messages using validationErrors property object. To overcome the issue we have to provide default error message using validationError property.

Reference of bug filed against the formsy repo: formsy/formsy-react#21

Display title for options of the SelectDropdown

As of now, SelectDropdown component is rendering the options' value field for the display of the option. To allow more readable option values, it should render title field of the option object.

Branch: feature/connectv2

Nav Bar || Standard list item component

This is a generic component which will be reused across multiple components.

Component tree

  • std-list-item
    • label(.text)
    • img(.icon)

Requirements:

  • Create a branch off of master and make a PR to master
  • Should support different layouts of text and icon, specifically:
    • icon above label (see example item in quick links item, icon is of 32x32 size)
    • icon in left and text following it (icon should be of 16x16)
    • text in left and icon on the right (icon should be of 16x16)
  • rendering of icon and text should both be configurable so that the user can use any of them or both

Fix lint

npm run lint produces 76 Errors which can be fixed.

Support Dropdown form component

Right now we don't have any form component which renders similar to the select dropdown.

Actually, we have the component but it does not reside in react-components repo. It is located here. Scope of this issue is now to port that component to react-components repo.

Update Travis CI configuration to allow use of version for components

We need to start using version in react-components and tc-ui so that changes will be distributed on npm i, and also for keeping consistency. Currently Travis CI has a problem with version upgrades.

We also can use version to lock components on different apps, which would make it easy to version lock the development

Progress Bar React component

Requirements

  • Should be styled as shown in specks (Please see the timeline component)
  • Should support checkpoints
  • Without checkpoints there would be no checkpoint circles

Nav Bar || User Dropdown Menu

This component contains links that are needed for a logged in user.

Component tree

  • user-dropdown-menu
    • dropdown-menu-header
      • user-image
      • username
      • dropdown-arrow
    • dropdown-menu-list(.user-menu-items-list)
      • std-list-item(.user-menu-item)

Requirements:

  • Create a branch off of master and make a PR to master
  • Should support non logged in view as rendered in the design specks
  • Should support logged in view as rendered in the design specks
  • Reuse the dropdown-menu component
  • Should be responsive to support the mobile layout

Tooltip React Component

Requirements:

  • Should match the style shown in specks
  • The tooltip should be flexible and detect the position of the target relative to the viewport edge. By default the preferred orientation of the tooltip is above the target, centered. If this is not possible, the tooltip should try to stay above the target and the tooltip pointer should align with the center of the target. It should follow top, right, bottom, left as order of precedence when it is not possible to render it at particular placement, move to the next.
  • Tooltips should be at least 10px (should be configurable) from the viewport edge. The tooltip pointer should be 5px (should be configurable) from the target.
  • Use a css-only solution for the tooltip pointer: square that is rotated 45ΒΊ and aligns with the background. This way you can position it centered to the target, and use drop-shadow if needed for the whole thing.
  • Should allow any content (e.g. any other React component) inside the tooltip
  • Tooltip trigger should be configurable. For now, we need click and hover as two possible triggers
  • Delay (in milliseconds) in rendering the tooltip, on the configured trigger, should also be configurable
  • Should support themes. For now we would have only single theme, default.
  • Should support adding custom css class to the root container of the tooltip

Nav Bar || Menu Bar

This is very simple component which just contains few links.

Component tree

  • menu-bar
    • menu-item

Requirements:

  • Create a branch off of master and make a PR to master
  • Should be responsive as rendered in the design specks
  • Should support highlighting the selected menu item

isRequired validator doesn't support numeric values

If we have TCFormFields.TextInput component with type="number" and we use isRequired validate rule like validations={ isRequired: true }, then on rendering such component with value which is numerical there would be error in console:

index.js?15f1:23 Uncaught TypeError: value.trim is not a function
    at Object.eval [as isRequired]

The reason for this is code in this file https://github.com/appirio-tech/react-components/blob/feature/connectv2/components/Formsy/index.js. It applies trim() method to the value without prior checking if value is a string.

Remove console errors

Current console errors to be removed:

  • missing key for TiledRadioGroup component
    - [ ] required property children error for FileList component

Update: FileList component does not exists in this repo. So, removing that.

Nav Bar || Panel React Component

This is a generic component which would be reused in other components.

Component tree

  • panel
    • panel-header
    • panel-body

Requirements

  • Should transclude the content in panel-header and panel-body
  • Should support collapsing/expanding the panel body on click of specified DOM element in the panel header

Nav Bar || Dropdown React Component

This is a generic component which will be reused in many other components.

Component tree

  • dropdown-menu
    • dropdown-menu-header
    • dropdown-menu-list

Requirements

  • Create a branch off of master and make a PR to master
  • Should transclude the content in dropdown-menu-header and dropdown-menu-list
  • Should support abstracting the logic of opening and closing the dropdown list
  • Should be configurable to show/hide menu pointer
    • Use :after pseudo-elements and rotate a rectangle that is clipped; we want a pure CSS pointer that also drops shadow.
  • Should support rendering the dropdown list into specified DOM element which would allow us to render the dropdown list in mobile view as slide down just below the nav header. (@vic-appirio do we need this feature to allow dropdowns to open in mobiles?)

Nav Bar || Search Bar

This component requires the search-suggestion-panel component as a dependency.

Component tree

  • search-bar
    • input(.search-bar__text)
    • img(.search-bar__icon)
    • search-suggestion-panel(.search-bar__dropdown)

Requirements:

  • Create a branch off of master and make a PR to master
  • Should be responsive as rendered in the design specks
  • Should implement typeahead/autocomplete feature. For now, it can consume some JSON residing in the component itself, which will be made dynamic at the time of integration.

Nav Bar || Quick Links Dropdown menu

This component contains quick links for easy access to different applications under the Topcoder platform.

Component tree

  • quick-links-dropdown-menu
    • dropdown-menu-header
      • img(.quick-links-icon)
    • dropdown-menu-list(.quick-links-list)
      • std-list-item(.quick-link-item)

Requirements:

  • Create a branch off of master and make a PR to master
  • Should be responsive to support the mobile layout as rendered in the design specks
  • Reuse the dropdown-menu component

Support column layout for RadioGroup component

As of now, RadioGroup component is rendered only horizontally which creates problems some time when we have long strings as options for the radio group.
Adding this support would allow user of the component to specify layout in props and the component would render accordingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.