Praise be to Allah.
If a person feels self admiration after doing something good or fears that he may show off, he should ward that off and resist it by seeking refuge with Allaah from it, and saying “Allaahumma inni a’oodhu bika an ushrika bika wa ana a’lam, wa’staghfiruka lima laa a’lam (O Allaah, I seek refuge with you from knowingly associating anything with You, and I seek Your forgiveness for that of which I am unaware)” – as was reported from the Prophet (peace and blessings of Allaah be upon him).
These kind of feelings happen to everyone, but you have to try to be sincere towards Allaah, seek His forgiveness, and remember that there is no strength and no power except with Allaah; if it were not for the help of Allaah, you would not have been able to do this good deed, so to Allaah be praise in the beginning and at the end.
The Prophet (peace and blessings of Allaah be upon him) said to Mu’aadh ibn Jabal: “O Mu’aadh, by Allaah indeed I love you, and I advise you, O Mu’aadh, do not forget at the end of every prayer to say: Allaahumma a’inni ‘ala dhikrika wa shukrika wa husni ‘ibaaditika (O Allaah, help me to remember You, give thanks to You and worship You in the best way).”(Narrated by Ahmad, Abu Dawood, al-Nasaa’i, and others; it is saheeh).
Do not forego doing good deeds for fear of showing off, because this is one of the tricks that the Shaytaan uses to weaken people’s resolve and stop them from doing things that Allaah loves and is pleased with.
As for merely feeling happy that one has done a good deed, this does not contradict sincerity and faith, for Allaah says (interpretation of the meaning):
“Say: “In the Bounty of Allâh, and in His Mercy (i.e. Islâm and the Qur’ân); therein let them rejoice.” That is better than what (the wealth) they amass” [Yoonus 10:58] – meaning, if he attains guidance, faith and righteous deeds, and the mercy resulting from that overwhelms him and he feels joy and success as a result. Hence Allaah commanded us to rejoice over such things.
The Prophet (peace and blessings of Allaah be upon him) said: “If your good deeds make you happy and your bad deeds make you sad, then you are a believer.”(Narrated by Ahmad, Ibn Majaah and others from the hadeeth of Abu Umaamah; it is a saheeh hadeeth).
By the same token, if people praise you for your good deed, then this is a portion of the glad tidings of the Hereafter, which Allaah gives a person in this world. The Messenger of Allaah (peace and blessings of Allaah be upon him) was asked, “What do you think if a man does a good deed and the people praise him for it?” He said: “That is the portion of the glad tidings for the believer which he is given in this world.”(Narrated by Muslim from the hadeeth of Abu Hurayrah, may Allaah be pleased with him).
So this praise is a sign that Allaah is pleased with him and loves him, so He makes him dear to other people.
We ask Allaah to make our intentions and deeds right.