rusackas commented on a change in pull request #13794: URL: https://github.com/apache/superset/pull/13794#discussion_r603021815
########## File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/LoadingBox.tsx ########## @@ -0,0 +1,34 @@ +/** + * 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 { styled } from '@superset-ui/core'; +import React from 'react'; +import Loading from 'src/components/Loading'; + +const StyledLoadingBox = styled.div` + position: relative; + height: ${({ theme }) => theme.gridUnit * 8}px; +`; + +export default function LoadingBox() { + return ( + <StyledLoadingBox> + <Loading /> Review comment: Actually, now that I look at this again, if you do the `<Loading position="inline" />` bit, then you no longer need the `position: relative;` or `height: ${({ theme }) => theme.gridUnit * 8}px;` styles. This feels a bit cleaner to me. Of course... it may be worth pointing out that if you don't mind the Loading icon being left-aligned, then you could skip that `text-align: center;` style.... which means you don't need the `StyledLoadingBox` div at all... which means you don't need the `LoadingBox` component at all. And now, to completely belabor this... If you DO want the loading centered, but think you might want that to be highly reusable, and don't want to bother with adding the `LoadingBox` component, then you can edit `src/component/Loading/index.tsx` and add the functionality there: 1. Add an `inline-centered` class following the `inline` class: ``` &.inline { margin: 0px; width: 30px; } &.inline-centered { margin: 0 auto; width: 30px; display: block; } ``` 2. Update `PositionOption` to include `inline-centered` 3. Simply use `<Loading position="inline-centered" />` in `FilterValue.tsx` instead of `<LoadingBox />` -- 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]
