MoreFunEffects.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import {moreEffects} from '@/common/components/effects/EffectsUtils';
  17. import EffectVariantBadge from '@/common/components/effects/EffectVariantBadge';
  18. import ToolbarActionIcon from '@/common/components/toolbar/ToolbarActionIcon';
  19. import ToolbarSection from '@/common/components/toolbar/ToolbarSection';
  20. import useVideoEffect from '@/common/components/video/editor/useVideoEffect';
  21. import {EffectIndex} from '@/common/components/video/effects/Effects';
  22. import {activeHighlightEffectAtom} from '@/demo/atoms';
  23. import {useAtomValue} from 'jotai';
  24. export default function MoreFunEffects() {
  25. const setEffect = useVideoEffect();
  26. const activeEffect = useAtomValue(activeHighlightEffectAtom);
  27. return (
  28. <ToolbarSection title="Selected Objects" borderBottom={true}>
  29. {moreEffects.map(effect => {
  30. return (
  31. <ToolbarActionIcon
  32. variant="toggle"
  33. key={effect.title}
  34. icon={effect.Icon}
  35. title={effect.title}
  36. isActive={activeEffect.name === effect.effectName}
  37. badge={
  38. activeEffect.name === effect.effectName && (
  39. <EffectVariantBadge
  40. label={`${activeEffect.variant + 1}/${activeEffect.numVariants}`}
  41. />
  42. )
  43. }
  44. onClick={() => {
  45. setEffect(effect.effectName, EffectIndex.HIGHLIGHT);
  46. }}
  47. />
  48. );
  49. })}
  50. </ToolbarSection>
  51. );
  52. }