Optical properties of graphene nanoribbon in a spatially modulated magnetic field