Hagia Sophia also known as "tent of the heavens" is a mammoth structure originally built by the emperor Constantine on the shores of river Bosporus in A.D. 326. Till the year 532 when it was destroyed, both the Christians and the Muslims revered it as the holiest place of their religion.
The destruction had occurred in 532, during the reign of Justinian the Builder, who started the reconstruction of Hagia Sophia only after 39 days after the destruction.
Justinian embellished the interior with riches. Four acres of gold mosaics shimmered from the ceiling, and multicolored marble gleamed from the floors, columns, and wall panels.
Again, during the year A.D. 558 much of it collapsed due to the many earthquakes in the region.There are more stories of collapses and reconstruction during the following years.
Read here fully.