-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce range component for firearms
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { t, Trans } from '@lingui/macro' | ||
import React from 'react' | ||
|
||
import type { Range } from '@/domain/weapon' | ||
|
||
const RangeFragment = ({ | ||
range, | ||
compact = false, | ||
}: { | ||
range: Range | null | ||
compact?: boolean | ||
}) => { | ||
if (!range) { | ||
return '-' | ||
} | ||
|
||
if (compact) { | ||
return ( | ||
<> | ||
{range.short}/<span title={t`Middle, -4 AB`}>{range.medium}</span>/ | ||
<span title={t`Long, -8 AB`}>{range.long}</span> | ||
</> | ||
) | ||
} else { | ||
return ( | ||
<ul> | ||
<li> | ||
<Trans>Short</Trans>: {range.short} <Trans>ft</Trans> | ||
</li> | ||
<li> | ||
<Trans>Medium</Trans>: {range.medium} <Trans>ft</Trans>{' '} | ||
<span className='ph-color-muted text-sm'>(-4 AB)</span> | ||
</li> | ||
<li> | ||
<Trans>Long</Trans>: {range.long} <Trans>ft</Trans> | ||
<span className='ph-color-muted text-sm'> (-8 AB)</span> | ||
</li> | ||
</ul> | ||
) | ||
} | ||
} | ||
|
||
export default RangeFragment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters