keep-around/18b5c8c2d85d9265c82f81450a4aa6ac0a73fdd3
parent
c838b5b01b
commit
18b5c8c2d8
@ -0,0 +1,70 @@ |
||||
import isNumber from 'lodash/isNumber' |
||||
import map from 'lodash/map' |
||||
|
||||
import { T9n } from 'features/T9n' |
||||
import { MatchPackage, SubscriptionType } from 'features/BuyMatchPopup/types' |
||||
|
||||
import { |
||||
Pass, |
||||
Name, |
||||
Description, |
||||
InfoWrapper, |
||||
Item, |
||||
List, |
||||
Price, |
||||
} from './styled' |
||||
|
||||
type Props = { |
||||
onSelect: (subscription: MatchPackage) => void, |
||||
packages: Array<MatchPackage>, |
||||
selectedPackage: MatchPackage | null, |
||||
} |
||||
|
||||
export const PackagesList = ({ |
||||
onSelect, |
||||
packages, |
||||
selectedPackage, |
||||
}: Props) => ( |
||||
<List> |
||||
{ |
||||
map( |
||||
packages, |
||||
(subPackage) => ( |
||||
<Item |
||||
key={subPackage.id} |
||||
onClick={() => onSelect(subPackage)} |
||||
active={subPackage === selectedPackage} |
||||
> |
||||
<InfoWrapper> |
||||
<Pass> |
||||
<T9n t={subPackage.pass} /> |
||||
</Pass> |
||||
<Name> |
||||
{ |
||||
isNumber(subPackage.nameLexic) |
||||
? <T9n t={subPackage.nameLexic} /> |
||||
: subPackage.name |
||||
} |
||||
</Name> |
||||
<Description> |
||||
<T9n |
||||
t={subPackage.description.lexic} |
||||
values={subPackage.description.values} |
||||
/> |
||||
</Description> |
||||
</InfoWrapper> |
||||
<Price |
||||
amount={subPackage.price} |
||||
currency={subPackage.currency} |
||||
perPeriod={ |
||||
subPackage.type !== SubscriptionType.Month |
||||
? null |
||||
: `per_${subPackage.type}` |
||||
} |
||||
/> |
||||
</Item> |
||||
), |
||||
) |
||||
} |
||||
</List> |
||||
) |
||||
@ -1,62 +0,0 @@ |
||||
import map from 'lodash/map' |
||||
|
||||
import { T9n } from 'features/T9n' |
||||
import { MatchSubscription, SubscriptionType } from 'features/BuyMatchPopup/types' |
||||
|
||||
import { |
||||
Pass, |
||||
Name, |
||||
Description, |
||||
InfoWrapper, |
||||
Item, |
||||
List, |
||||
Price, |
||||
} from './styled' |
||||
|
||||
type Props = { |
||||
onSelect: (subscription: MatchSubscription) => void, |
||||
selectedSubscription: MatchSubscription | null, |
||||
subscriptions: Array<MatchSubscription>, |
||||
} |
||||
|
||||
export const SubscriptionsList = ({ |
||||
onSelect, |
||||
selectedSubscription, |
||||
subscriptions, |
||||
}: Props) => ( |
||||
<List> |
||||
{ |
||||
map( |
||||
subscriptions, |
||||
(subscription) => { |
||||
const { description, type } = subscription |
||||
|
||||
return ( |
||||
<Item |
||||
key={subscription.id} |
||||
onClick={() => onSelect?.(subscription)} |
||||
active={subscription === selectedSubscription} |
||||
> |
||||
<InfoWrapper> |
||||
<Pass> |
||||
<T9n t={subscription.pass} /> |
||||
</Pass> |
||||
<Name> |
||||
{subscription.name} |
||||
</Name> |
||||
<Description> |
||||
<T9n t={description.lexic} values={description.values} /> |
||||
</Description> |
||||
</InfoWrapper> |
||||
<Price |
||||
amount={subscription.price} |
||||
currency={subscription.currency} |
||||
perPeriod={type !== SubscriptionType.Month ? null : `per_${type}`} |
||||
/> |
||||
</Item> |
||||
) |
||||
}, |
||||
) |
||||
} |
||||
</List> |
||||
) |
||||
Loading…
Reference in new issue