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

Code duplication in filter icon selection #5

Closed
txau opened this issue May 24, 2016 · 1 comment
Closed

Code duplication in filter icon selection #5

txau opened this issue May 24, 2016 · 1 comment
Assignees
Labels

Comments

@txau
Copy link
Collaborator

txau commented May 24, 2016

Code duplication? this could even lead to displaying different icons if the code is changed separately.

https://github.com/huridocs/UwaziDocs/blob/9fcc2009263a36f4885b0e0bcc7bd70dfef2c973/app/react/Templates/components/MetadataProperty.js

let iconClass = 'fa fa-font';
    if (this.props.type === 'select') {
      iconClass = 'fa fa-sort';
    }

    if (this.props.type === 'list') {
      iconClass = 'fa fa-list';
    }

    if (this.props.type === 'date') {
      iconClass = 'fa fa-calendar';
    }

    if (this.props.type === 'checkbox') {
      iconClass = 'fa fa-check-square-o';
    }

https://github.com/huridocs/UwaziDocs/blob/9fcc2009263a36f4885b0e0bcc7bd70dfef2c973/app/react/Templates/components/FilterSuggestions.js

getTypeIcon(type) {
    let icon;
    switch (type) {
    case 'checkbox':
      icon = 'fa fa-check-square-o';
      break;
    case 'select':
      icon = 'fa fa-sort';
      break;
    case 'list':
      icon = 'fa fa-list';
      break;
    case 'date':
      icon = 'fa fa-calendar';
      break;
    default:
      icon = 'fa fa-font';
    }

    return icon;
  }
@konzz
Copy link
Member

konzz commented Jun 4, 2016

Fixed with #81

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

No branches or pull requests

2 participants