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

refactor: remove redundant propTypes in ColumnElement #18144

Merged
merged 3 commits into from
Feb 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions superset-frontend/src/SqlLab/components/ColumnElement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import React, { FC } from 'react';
import { ClassNames } from '@emotion/react';
import { styled, useTheme } from '@superset-ui/core';

import { Tooltip } from 'src/components/Tooltip';

const propTypes = {
column: PropTypes.object.isRequired,
};

const StyledTooltip = (props: any) => {
const theme = useTheme();
return (
Expand Down Expand Up @@ -64,6 +58,7 @@ const iconMap = {
fk: 'fa-link',
index: 'fa-bookmark',
};

const tooltipTitleMap = {
pk: 'Primary key',
fk: 'Foreign key',
Expand All @@ -74,14 +69,14 @@ export type ColumnKeyTypeType = keyof typeof tooltipTitleMap;

interface ColumnElementProps {
column: {
name: string;
name: React.ReactNode;
EugeneTorap marked this conversation as resolved.
Show resolved Hide resolved
keys?: { type: ColumnKeyTypeType }[];
type: string;
};
}

export default function ColumnElement({ column }: ColumnElementProps) {
let columnName: React.ReactNode = column.name;
const ColumnElement: FC<ColumnElementProps> = ({ column }) => {
EugeneTorap marked this conversation as resolved.
Show resolved Hide resolved
let columnName = column.name;
let icons;
if (column.keys && column.keys.length > 0) {
columnName = <strong>{column.name}</strong>;
Expand Down Expand Up @@ -115,5 +110,6 @@ export default function ColumnElement({ column }: ColumnElementProps) {
</div>
</div>
);
}
ColumnElement.propTypes = propTypes;
};

export default ColumnElement;