Skip to content

Commit

Permalink
move components to components folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nytai committed Apr 13, 2020
1 parent 176dfc8 commit c6b15e7
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 47 deletions.
5 changes: 1 addition & 4 deletions superset-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
globals: {
'ts-jest': {
babelConfig: true,
diagnostics: {
warnOnly: true,
},
tsConfig: {
jsx: 'react',
esModuleInterop: true,
},
},
},
};
41 changes: 2 additions & 39 deletions superset-frontend/src/components/ListView/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import React, { useState } from 'react';
import styled from '@emotion/styled';
import { withTheme } from 'emotion-theming';
// @ts-ignore
import Select from 'react-select';

import StyledSelect from 'src/components/StyledSelect';
import SearchInput from 'src/components/SearchInput';
import { Filter, Filters, FilterValue, InternalFilter } from './types';

interface BaseFilter {
Expand All @@ -34,33 +34,6 @@ interface SelectFilterProps extends BaseFilter {
emptyLabel?: string;
}

const StyledSelect = styled(Select)`
display: inline;
&.is-focused:not(.is-open) > .Select-control {
border: none;
box-shadow: none;
}
.Select-control {
display: inline-table;
border: none;
width: 100px;
&:focus,
&:hover {
border: none;
box-shadow: none;
}
.Select-arrow-zone {
padding-left: 10px;
}
}
.Select-menu-outer {
margin-top: 0;
border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
}
`;

const FilterContainer = styled.div`
display: inline;
margin-right: 8px;
Expand Down Expand Up @@ -120,16 +93,6 @@ interface SearchHeaderProps extends BaseFilter {
onSubmit: (val: string) => void;
}

const SearchInput = styled.input`
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
padding: 4px 8px;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
`;

function SearchFilter({ Header, initialValue, onSubmit }: SearchHeaderProps) {
const [value, setValue] = useState(initialValue || '');
const handleSubmit = () => onSubmit(value);
Expand Down
29 changes: 29 additions & 0 deletions superset-frontend/src/components/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* 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 '@emotion/styled';

export default styled.input`
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
padding: 4px 8px;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
`;
48 changes: 48 additions & 0 deletions superset-frontend/src/components/StyledSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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 '@emotion/styled';
// @ts-ignore
import Select from 'react-select';

export default styled(Select)`
display: inline;
&.is-focused:not(.is-open) > .Select-control {
border: none;
box-shadow: none;
}
.Select-control {
display: inline-table;
border: none;
width: 100px;
&:focus,
&:hover {
border: none;
box-shadow: none;
}
.Select-arrow-zone {
padding-left: 10px;
}
}
.Select-menu-outer {
margin-top: 0;
border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
}
`;
8 changes: 4 additions & 4 deletions superset-frontend/src/views/dashboardList/DashboardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class DashboardList extends React.PureComponent<Props, State> {
original: { published },
},
}: any) => (
<span className="no-wrap">
{published ? <i className="fa fa-check" /> : ''}
</span>
),
<span className="no-wrap">
{published ? <i className="fa fa-check" /> : ''}
</span>
),
Header: t('Published'),
accessor: 'published',
sortable: true,
Expand Down

0 comments on commit c6b15e7

Please sign in to comment.