{"size": 1177, "ext": "js", "max_stars_repo_path": "src/components/ui/languageConverter.js", "max_stars_repo_name": "junjun0103/tourism-queens-travel-", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/ui/languageConverter.js", "max_issues_repo_name": "junjun0103/tourism-queens-travel-", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/ui/languageConverter.js", "max_forks_repo_name": "junjun0103/tourism-queens-travel-", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.6346153846, "max_line_length": 72, "alphanum_fraction": 0.5429056924}
import React, { useContext } from "react"
import { GlobalStateContext } from "../../context/GlobalContextProvider"
import "../../css/components/languageConverter.css"

// tag : h3 or h4
// valueEn/valueCn : value for english or chinese
// styleGlobal : syle for english and chinese
// styleEn/styleCn : style for english or chinese
const LanguageConverter = ({
  tag,
  valueEn,
  valueCn,
  styleEn,
  styleCn,
  styleGlobal,
}) => {
  const state = useContext(GlobalStateContext) || { lenguage: "CN" }

  // return h4 tag
  if (tag === "h4") {
    return (
      <div>
        <h4
          className={`${styleGlobal} ${
            state.lenguage === "EN" ? styleEn : `cn_h4 ${styleCn}`
          }`}
        >
          {state.lenguage === "EN" ? valueEn : valueCn}
        </h4>
      </div>
    )
  }
  // return h3 tag
  else if (tag === "h3") {
    return (
      <div>
        <h3
          className={`${styleGlobal} ${
            state.lenguage === "EN" ? styleEn : `cn_h3 ${styleCn}`
          }`}
        >
          {state.lenguage === "EN" ? valueEn : valueCn}
        </h3>
      </div>
    )
  } else {
    return null
  }
}

export default LanguageConverter
