So long as your relationship with the company is pleasant, the "proper" notice to give depends on the specifics of the position and could be longer than 2 weeks. It's polite to give enough time so that you can transition your responsibilities to whomever will be taking them over. In senior positions I've often given 4 weeks notice, but I know some people who commonly give 6 or more.
Continuing to be a productive part of the team during that period of time is simply a matter of professionalism. It's true that occasionally one party or the other is incapable of continuing to work together, but that's pretty rare in my experience.