Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #258 from deriv-com/prince/remove-trustpilot-hook
Browse files Browse the repository at this point in the history
Prince/remove trustpilot hook
  • Loading branch information
prince-deriv authored Dec 12, 2023
2 parents 487fd55 + 22089ef commit 1931222
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Default: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.5,
numberOfReviews: '45454',
stars: 4.4,
Expand All @@ -40,7 +40,7 @@ export const CustomTheme: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.5,
numberOfReviews: '45454',
stars: 4.4,
Expand All @@ -67,7 +67,7 @@ export const BadScore: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 0.6,
numberOfReviews: '45454',
stars: 0.6,
Expand All @@ -90,7 +90,7 @@ export const PoorScore: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 1.6,
numberOfReviews: '45454',
stars: 1.6,
Expand All @@ -113,7 +113,7 @@ export const AverageScore: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 2.5,
numberOfReviews: '45454',
stars: 2.5,
Expand All @@ -136,7 +136,7 @@ export const GreatScore: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 3.8,
numberOfReviews: '99990',
stars: 3.8,
Expand All @@ -159,7 +159,7 @@ export const ExcellentScore: Story = {
'Excellent',
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.8,
numberOfReviews: '45454',
stars: 4.8,
Expand Down
7 changes: 2 additions & 5 deletions libs/blocks/src/lib/social-proof/horizontal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Section, Text, qtMerge } from '@deriv/quill-design';
import { Rating } from '@deriv-com/components';
import { useTrustpilotApi } from '@deriv-com/hooks';
import { SocialProofProps } from '../types';
import { getThemeClassNames } from '../classnames';
import { redirectToTrustpilot } from '../helper';
Expand All @@ -10,10 +9,8 @@ const SocialProofHorizontal = ({
className,
content,
logo,
staticData = null,
data = null,
}: SocialProofProps) => {
const { data } = useTrustpilotApi(staticData);

const themeClassNames = getThemeClassNames(theme);

return (
Expand All @@ -25,7 +22,7 @@ const SocialProofHorizontal = ({
)}
>
<div
className="flex items-center justify-center gap-gap-xl"
className="flex cursor-pointer items-center justify-center gap-gap-xl"
onClick={redirectToTrustpilot}
>
{data && (
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/src/lib/social-proof/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface SocialProofProps {
content?: ({ ...props }: TPilotDataProps) => string[] | ReactNode[];
className?: string;
logo: ReactNode;
staticData?: TPilotDataProps | null;
data?: TPilotDataProps | null;
}

export interface SocialProofThemeClassNames {
Expand Down
8 changes: 2 additions & 6 deletions libs/blocks/src/lib/social-proof/vertical/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Heading, Section, Text, qtMerge } from '@deriv/quill-design';
import { Rating } from '@deriv-com/components';
import { useTrustpilotApi } from '@deriv-com/hooks';

import { SocialProofProps } from '../types';
import { getThemeClassNames } from '../classnames';
import { redirectToTrustpilot } from '../helper';
Expand All @@ -15,11 +13,9 @@ const SocialProofVertical = ({
theme,
className,
content,
staticData,
data,
logo,
}: SocialProofVerticalProps) => {
const { data } = useTrustpilotApi(staticData);

const themeClassNames = getThemeClassNames(theme);

return (
Expand All @@ -31,7 +27,7 @@ const SocialProofVertical = ({
)}
>
<div
className="flex flex-col items-center gap-gap-3xl"
className="flex cursor-pointer flex-col items-center gap-gap-3xl"
onClick={redirectToTrustpilot}
>
{title && (
Expand Down
14 changes: 7 additions & 7 deletions libs/blocks/src/lib/social-proof/vertical/vertical.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Default: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.5,
numberOfReviews: '45454',
stars: 4.4,
Expand All @@ -38,7 +38,7 @@ export const CustomTheme: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.5,
numberOfReviews: '45454',
stars: 4.4,
Expand All @@ -65,7 +65,7 @@ export const BadScore: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 0.6,
numberOfReviews: '45454',
stars: 0.6,
Expand All @@ -87,7 +87,7 @@ export const PoorScore: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 1.6,
numberOfReviews: '45454',
stars: 1.6,
Expand All @@ -109,7 +109,7 @@ export const AverageScore: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 2.5,
numberOfReviews: '45454',
stars: 2.5,
Expand All @@ -131,7 +131,7 @@ export const GreatScore: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 3.8,
numberOfReviews: '99990',
stars: 3.8,
Expand All @@ -153,7 +153,7 @@ export const ExcellentScore: Story = {
`TrustScore ${trustScore}`,
`${numberOfReviews} reviews`,
],
staticData: {
data: {
trustScore: 4.8,
numberOfReviews: '45454',
stars: 4.8,
Expand Down
1 change: 0 additions & 1 deletion libs/hooks/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './lib/use-build-variant';
export * from './lib/use-navigation';
export * from './lib/use-shared-link';
export * from './lib/use-trustpilot';
export * from './lib/use-lang-switcher';
153 changes: 0 additions & 153 deletions libs/hooks/src/lib/use-trustpilot/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion libs/templates/src/lib/home/sections/review/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ReviewSection = () => {
/>
}
//TODO: We will remove this static data once the data fetching is finalized.
staticData={{
data={{
trustScore: 4.6,
numberOfReviews: '37,133',
stars: 4.6,
Expand Down

0 comments on commit 1931222

Please sign in to comment.