The newly elected prime minister of France has resigned hours after naming a new government, which has further complicated the political landscape in the nation.