In the limit, i.e. if all 30 are e.g. novels, there are 30! ways.
If there are 10 of each, then it's 3 x 10!.
So suppose there are x novels, y math books and z history books.
Then there are arrangements.
It can be simplified by letting : there are arrangements.
OTOH the answer could well be "Only one." If you're a manic arranger so your books are arranged neatly like that, you're going to arrange them in a rigid order within the categories.