ktmud commented on a change in pull request #13277: URL: https://github.com/apache/superset/pull/13277#discussion_r581422170
########## File path: superset-frontend/src/components/Pagination/index.ts ########## @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Next } from './Next'; +import { Prev } from './Prev'; +import { Item } from './Item'; +import { Ellipsis } from './Ellipsis'; +import { PaginationWrapper } from './PaginationWrapper'; Review comment: Adding typing to `children` was just another suggestion unrelated to code organization. Having custom types for `children` enforces the usage of `<Pagination>...</Pagination>` so that TypeScript can warn you when other children types are used. E.g. this code ```tsx <Pagination> <li className="pagi">Select control</li> </Pagination> ``` should show an error because an arbitrary `childNode` will either render incorrectly or create customization outside of the component itself, defeating the purpose of component abstraction. Re: `PaginationWrapper` vs `Pagination`, it really doesn't matter that much. But when the component is used outside of `createUltimatePagination`, do you really think ```ts import Pagination from 'src/components/pagination'; <Pagination.PaginationWrapper> <Pagination.Prev /> <Pagination.Prev /> </Pagination.PaginationWrapper> ``` reads better than ```ts import Pagination from 'src/components/pagination'; <Pagination> <Pagination.Prev /> <Pagination.Prev /> </Pagination> ``` ? I don't get your point about assignments. I'll defer to @nytai on which style to use since he's the original author of this component. TBH the original class component style also works perfectly fine to me. As a general note, if all we wanted was adding tests to make sure components work correctly, I'd refrain from doing pure code style refactoring unless there are clear benefits to do so. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
