diff --git a/src/assets/images/catalog/gift/gift_tag.png b/src/assets/images/gift/gift_tag.png similarity index 100% rename from src/assets/images/catalog/gift/gift_tag.png rename to src/assets/images/gift/gift_tag.png diff --git a/src/assets/images/catalog/gift/incognito.png b/src/assets/images/gift/incognito.png similarity index 100% rename from src/assets/images/catalog/gift/incognito.png rename to src/assets/images/gift/incognito.png diff --git a/src/layout/Layout.scss b/src/layout/Layout.scss index b8e28186..3b613a5f 100644 --- a/src/layout/Layout.scss +++ b/src/layout/Layout.scss @@ -29,3 +29,4 @@ @import './mini-camera/NitroLayoutMiniCameraView'; @import './notification-bubble/NotificationBubbleView'; @import './trophy/NitroLayoutTrophyView'; +@import './gift-card/NitroLayoutGiftCardView'; diff --git a/src/layout/gift-card/NitroLayoutGiftCardView.scss b/src/layout/gift-card/NitroLayoutGiftCardView.scss new file mode 100644 index 00000000..a2da0c9a --- /dev/null +++ b/src/layout/gift-card/NitroLayoutGiftCardView.scss @@ -0,0 +1,41 @@ +.nitro-gift-card { + width: 306px; + height: 159px; + background: url(../../assets/images/gift/gift_tag.png) center no-repeat; + + .gift-face { + width: 65px; + + .gift-incognito { + width: 37px; + height: 48px; + background: url(../../assets/images/gift/incognito.png) center no-repeat; + } + + .gift-avatar { + position: relative; + overflow: hidden; + width: 40px; + height: 50px; + + .avatar-image { + position: absolute; + left: -25px; + top: -20px; + } + } + } + + .gift-message { + width: 100%; + min-width: 100%; + max-width: 100%; + height: 90px; + min-height: 90px; + max-height: 90px; + border: none; + resize: none; + outline: none; + line-height: 17px; + } +} diff --git a/src/layout/gift-card/NitroLayoutGiftCardView.tsx b/src/layout/gift-card/NitroLayoutGiftCardView.tsx new file mode 100644 index 00000000..f9a1f3c6 --- /dev/null +++ b/src/layout/gift-card/NitroLayoutGiftCardView.tsx @@ -0,0 +1,25 @@ +import { FC } from 'react'; +import { LocalizeText } from '../../api'; +import { AvatarImageView } from '../../views/shared/avatar-image/AvatarImageView'; +import { NitroLayoutGiftCardViewProps } from './NitroLayoutGiftCardView.types'; + +export const NitroLayoutGiftCardView: FC = props => +{ + const { figure = null, userName = null, message = null, editable = false, onChange = null } = props; + + return ( +
+
+ { !userName &&
} + { figure &&
+ +
} +
+
+ { !editable &&
{ message }
} + { editable && onChange && } + { userName &&
{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }
} +
+
+ ); +}; diff --git a/src/layout/gift-card/NitroLayoutGiftCardView.types.ts b/src/layout/gift-card/NitroLayoutGiftCardView.types.ts new file mode 100644 index 00000000..c530d65c --- /dev/null +++ b/src/layout/gift-card/NitroLayoutGiftCardView.types.ts @@ -0,0 +1,8 @@ +export interface NitroLayoutGiftCardViewProps +{ + figure?:string; + userName?: string; + message?: string; + editable?: boolean; + onChange?: (value: string) => void; +} diff --git a/src/layout/gift-card/index.ts b/src/layout/gift-card/index.ts new file mode 100644 index 00000000..73f7d035 --- /dev/null +++ b/src/layout/gift-card/index.ts @@ -0,0 +1,2 @@ +export * from './NitroLayoutGiftCardView'; +export * from './NitroLayoutGiftCardView.types'; diff --git a/src/layout/index.ts b/src/layout/index.ts index 0d843596..f02a74e0 100644 --- a/src/layout/index.ts +++ b/src/layout/index.ts @@ -1,5 +1,6 @@ export * from './card'; export * from './draggable-window'; +export * from './gift-card'; export * from './loading-spinner'; export * from './mini-camera'; export * from './notification-bubble'; diff --git a/src/views/catalog/views/gift/CatalogPageGiftView.scss b/src/views/catalog/views/gift/CatalogPageGiftView.scss index a4a05f64..9f43a086 100644 --- a/src/views/catalog/views/gift/CatalogPageGiftView.scss +++ b/src/views/catalog/views/gift/CatalogPageGiftView.scss @@ -1,47 +1,5 @@ .nitro-catalog-gift { - - .gift-tag { - width: 306px; - height: 159px; - background: url(../../../../assets/images/catalog/gift/gift_tag.png) center no-repeat; - } - - .gift-face { - width: 65px; - - .gift-incognito { - width: 37px; - height: 48px; - background: url(../../../../assets/images/catalog/gift/incognito.png) center no-repeat; - } - - .gift-avatar { - position: relative; - overflow: hidden; - width: 40px; - height: 50px; - - .avatar-image { - position: absolute; - left: -25px; - top: -20px; - } - } - } - - .gift-message { - width: 100%; - min-width: 100%; - max-width: 100%; - height: 90px; - min-height: 90px; - max-height: 90px; - border: none; - resize: none; - outline: none; - line-height: 17px; - } - + .gift-preview { width: 80px; height: 80px; diff --git a/src/views/catalog/views/gift/CatalogPageGiftView.tsx b/src/views/catalog/views/gift/CatalogPageGiftView.tsx index 473e8785..b795554d 100644 --- a/src/views/catalog/views/gift/CatalogPageGiftView.tsx +++ b/src/views/catalog/views/gift/CatalogPageGiftView.tsx @@ -5,8 +5,7 @@ import { GetSessionDataManager, LocalizeText } from '../../../../api'; import { CatalogEvent } from '../../../../events'; import { CatalogInitGiftEvent } from '../../../../events/catalog/CatalogInitGiftEvent'; import { SendMessageHook, useUiEvent } from '../../../../hooks'; -import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout'; -import { AvatarImageView } from '../../../shared/avatar-image/AvatarImageView'; +import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutGiftCardView } from '../../../../layout'; import { CurrencyIcon } from '../../../shared/currency-icon/CurrencyIcon'; import { FurniImageView } from '../../../shared/furni-image/FurniImageView'; import { useCatalogContext } from '../../context/CatalogContext'; @@ -166,17 +165,8 @@ export const CatalogPageGiftView: FC<{}> = props => setReceiverName(e.target.value) } /> -
-
- { !showMyFace &&
} - { showMyFace &&
- -
} -
-
- - { showMyFace &&
{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [GetSessionDataManager().userName]) }
} -
+
+ setMessage(value) } />
setShowMyFace(value => !value) } />