Refactored flip animation into a component