How is Pearl both a constant reminder of sin and a joy to Hester?
Pearl is a constant reminder of sin because she is the "love child" born of the secret and illicit union of Hester and Dimmesdale. She is the reason Hester was exposed as a sexually "impure" and is now shunned by society and shamed by having to wear the scarlet letter.
Nevertheless, Pearl is a joy to Hester because of the child she is. She is pure and innocent, her soul white like a pearl. She is a child of nature, and she has a way of seeing through the surface of things to discern true goodness. She is likened to animals and sunlight.
Ironically, a union that in the eyes of society has left Hester stained "red" as a harlot has produced a "pearl-like" child of innocence and purity. Pearl calls into question just how sinful Hester and Dimmesdale's union really was.
Pearl is a constant reminder of sin because Hester conceived her through adultery, and she is always around. Her very existence is evidence of sin.
She's a joy because she's a fine and loving child, and because Hester loves her dearly.
Hester loves Pearl because she is her child and brings her such joy in her life. However, Pearl was conceived due to Hester's adultery with Dimmesdale, so she's a constant reminder of Hester's shame, of why she must wear the scarlet A.