Work done is the product of force applied on an object and magnitude of the displacement.
Mathematically, , where is the force applied in the direction of displacement, is the displacement , is the angle between force and displacement and is the work done.
Components of force is resolve in and .
Take the component of force which is in the direction of displacement, which is .