White House press secretary Karoline Leavitt will leave her role at the end of the month to spend more time with her family, President Donald Trump announced.