Sir James Cleverly has announced he is resigning from the shadow cabinet to stand to be Mayor of London.