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

docs(TableExampleSortable): your description #3964

Merged
merged 4 commits into from
Jul 28, 2020

Conversation

aws-eddy
Copy link
Contributor

Updated for react hooks

@welcome
Copy link

welcome bot commented Jun 16, 2020

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

}

export default Table;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export default Table;

function Table() {
const [column, updateColumn] = useState(null);
const [data, updateData] = useState(tableData);
const [direction, updateDirection] = useState(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that useRedurer will be a better solution in this case. Can we use it?


handleSort = (clickedColumn) => () => {
const { column, data, direction } = this.state
function Table() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function Table() {
export default TableExampleSortable() {
  • default export works for functions 😸
  • let's keep existing example name

{ name: 'Leslie', age: 25, gender: 'Other' },
{ name: 'Ben', age: 70, gender: 'Male' },
]
{ name: "John", age: 15, gender: "Male" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks that you have a different formatting there. Please run yarn prettier:fix & yarn lint:fix it should fix your issues and pass build.

@@ -1,62 +1,51 @@
import _ from 'lodash'
import React, { Component } from 'react'
import { Table } from 'semantic-ui-react'
import React, { useState } from "react";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import React, { useState } from "react";
import React from "react";

I suggest to use React.useState/React.useReducer as it gives more context from where hooks came.

@vercel vercel bot temporarily deployed to Preview July 28, 2020 13:07 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2020

Codecov Report

Merging #3964 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3964      +/-   ##
==========================================
- Coverage   99.84%   99.84%   -0.01%     
==========================================
  Files         184      183       -1     
  Lines        3220     3157      -63     
==========================================
- Hits         3215     3152      -63     
  Misses          5        5              
Impacted Files Coverage Δ
src/elements/Button/Button.js 95.45% <0.00%> (-0.11%) ⬇️
src/modules/Popup/Popup.js 98.71% <0.00%> (-0.04%) ⬇️
src/modules/Search/Search.js 99.53% <0.00%> (-0.03%) ⬇️
src/modules/Sticky/Sticky.js 99.07% <0.00%> (-0.01%) ⬇️
src/modules/Tab/Tab.js 100.00% <0.00%> (ø)
src/views/Card/Card.js 100.00% <0.00%> (ø)
src/elements/Flag/Flag.js 100.00% <0.00%> (ø)
src/elements/Icon/Icon.js 100.00% <0.00%> (ø)
src/elements/List/List.js 100.00% <0.00%> (ø)
src/elements/Step/Step.js 100.00% <0.00%> (ø)
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de506d5...74a7fde. Read the comment docs.

@layershifter layershifter merged commit b03ed50 into Semantic-Org:master Jul 28, 2020
@welcome
Copy link

welcome bot commented Jul 28, 2020

Congrats on merging your first pull request! 🎉🎉🎉

robot victory dance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants