SystemHostsItem.tsx 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * SystemHostsItem
  3. * @author: oldj
  4. * @homepage: https://oldj.net
  5. */
  6. import { useModel } from '@@/plugin-model/useModel'
  7. import ItemIcon from '@renderer/components/ItemIcon'
  8. import clsx from 'clsx'
  9. import React from 'react'
  10. import styles from './SystemHostsItem.less'
  11. interface Props {}
  12. const SystemHostsItem = (props: Props) => {
  13. const { i18n } = useModel('useI18n')
  14. const { current_hosts, setCurrentHosts } = useModel('useHostsData')
  15. const is_selected = !current_hosts
  16. const showSystemHosts = () => {
  17. setCurrentHosts(null)
  18. }
  19. return (
  20. <div
  21. className={clsx(styles.root, is_selected && styles.selected)}
  22. onClick={showSystemHosts}
  23. >
  24. <span className={styles.icon}>
  25. <ItemIcon type="system" />
  26. </span>
  27. <span>{i18n.lang.system_hosts}</span>
  28. </div>
  29. )
  30. }
  31. export default SystemHostsItem