Skip to content

Commit

Permalink
Merge pull request #29 from YunesB/fix/change-variant-to-reflect
Browse files Browse the repository at this point in the history
fix: change variant to reflect
  • Loading branch information
AlexandrHoroshih authored Feb 14, 2024
2 parents 88f555c + 8177023 commit 52058f5
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions apps/playground-app/src/features/brewery-of-the-day/view.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
"use client"
"use client";

import { reflect, variant } from "@effector/reflect";
import { BreweryCard, Loader } from "#root/shared/ui";
import { reflect } from "@effector/reflect";
import { BreweryCard } from "#root/shared/ui";

import { $breweryOfTheDay } from "./model";

export const BreweryOfTheDay = variant({
if: $breweryOfTheDay.map((brewery) => !!brewery),
then: reflect({
view: BreweryCard,
bind: {
name: $breweryOfTheDay.map((brewery) => brewery?.name ?? "Unknown"),
brewery_type: $breweryOfTheDay.map(
(brewery) => brewery?.brewery_type ?? "nano"
),
website_url: $breweryOfTheDay.map(
(brewery) => brewery?.website_url ?? null
),
image: $breweryOfTheDay.map((brewery) => brewery?.image ?? ""),
},
}),
else: Loader,
export const BreweryOfTheDay = reflect({
view: BreweryCard,
bind: {
name: $breweryOfTheDay.map((brewery) => brewery?.name ?? "Unknown"),
brewery_type: $breweryOfTheDay.map(
(brewery) => brewery?.brewery_type ?? "nano"
),
website_url: $breweryOfTheDay.map(
(brewery) => brewery?.website_url ?? null
),
image: $breweryOfTheDay.map((brewery) => brewery?.image ?? ""),
},
});

0 comments on commit 52058f5

Please sign in to comment.